Labs/Ubiquity/Parser Documentation: Difference between revisions

(Added the beginning.)
Line 13: Line 13:
=== Finding the Verb ===
=== Finding the Verb ===


First, the parser finds the verb in the sentence.  This is currently done by just taking the part of the string that occurs before the first space character: in other words, <tt>trans</tt> is our verb, and <tt>hello world to ja</tt> is the rest of our sentence.
First, the parser finds the verb in the sentence.   
 
To make internationalization easier, all operations which are (human)-language-dependent are handled by language-specific plugins.  Finding the verb is language-dependent: In some languages it comes before the object, in other languages after the object, etc.
 
So if Ubiquity is in English mode, then the sentence is dispatched to the English-specific parser plugin for verb detection.  Currently this is done by simply taking the part of the string that occurs before the first space character: in other words, <tt>trans</tt> is our verb, and <tt>hello world to ja</tt> is the rest of our sentence.
 
(Note: this simplistic way of getting the verb currently limits us to having only single-word command names.  It needs to be changed to support multi-word commands.)
1,007

edits