1,007
edits
No edit summary |
|||
| Line 27: | Line 27: | ||
= Methods of the Parser object = | = Methods of the Parser object = | ||
updateSuggestionList() | |||
getSuggestionList() | |||
* | Returns an array containing a list of suggestions, ordered best to worst, that the parser has generated based on the most recent user input (i.e. the input given in the last call to updateSuggestionList().) Each item in the array is a ParsedSentence object. | ||
* | |||
strengthenMemory(query, chosenSuggestion) | |||
Strengthens the association between a certain input and a certain suggestion. That is, if the user enters '''query''', the query is given to the parser, the parser produces a list of suggestions, and the user chooses '''chosenSuggestion''', then the UI code should then call parser.strengthenMemory(query, chosenSuggestion). The effect is to give a clue to the parser that the next time the user enters a string like '''query''', then '''chosenSuggestion''' should be ranked higher in the suggestion list. This enables the parser to improve its suggestions over time. | |||
getSentence(index) | |||
Returns the ParsedSentence at the given index in the suggestion list. | |||
getNumSuggestions() | |||
Returns the number of suggestions in the suggestion list. | |||
setCommandList(commandList) | |||
Updates the parser's internal list of all available verb names in the command set. commandList is an array of verb objects. If you know what the whole verb list is going to be when you instantiate the parser, you can just pass it into makeParserForLanguage, and never bother with this function; otherwise, you can pass an empty array into makeParserForLanguage and then later on call this function. | |||
setNounList(nounList) | |||
Like setCommandList, but updates the parser's internal list of all available noun types. nounList is an array of nounType objects. | |||
getSelectionObject() | |||
(Why is this exposed?) Returns an object representing the user's current selection. The object has two attributes: | |||
* '''.text''' a string containing the text selection only (i.e. no HTML tags) | |||
* '''.html''' a string containing the html selection (i.e. text with HTML tags) | |||
= The Verb, Noun, and ParsedSentence object interfaces = | |||
TODO | |||
edits