Labs/Ubiquity/Parser Documentation: Difference between revisions

Jump to navigation Jump to search
Line 132: Line 132:


=== Turning PartiallyParsedSentences into FullyParsedSentences ===
=== Turning PartiallyParsedSentences into FullyParsedSentences ===
The difference is that a PartiallyParsedSentence assigns a ''substring'' to each argument of the verb; a FullyParsedSentence assigns a '''noun suggestion''' to each argument of the verb.  To turn one into the other involves giving the substring to a NounType and getting back a list of noun suggestions; we can then instantiate one FullyParsedSentence for each suggestion.
In practical terms, if our PartiallyParsedSentence is this:
Verb: Translate; Direct object: "hello, world"; To: "ja"
Then noun_type_language.suggest() might produce two suggestions based on "ja":
* {text:"japanese", data: "jp"}
* {text:"javanese", data: "jv"}
(This is a bad example because we don't actually have Javanese implemented, but bear with me.)  Meanwhile, noun_arb_text which is the type of the direct object produces just one suggestion:
{text:"hello, world"}
So we now produce two FullyParsedSentences which are:
* Verb: Translate; Direct object: {text:"hello, world"}; To: {text:"japanese"}
* Verb: Translate; Direct object: {text:"hello, world"}; To: {text:"javanese"}


=== Filling missing arguments with the selection ===
=== Filling missing arguments with the selection ===
1,007

edits

Navigation menu