Labs/Ubiquity/Parser 2 API Conversion Tutorial: Difference between revisions

Jump to navigation Jump to search
Line 24: Line 24:


=== <code>names</code> ===
=== <code>names</code> ===
Where Parser 1 expected a single default verb name in the property <code>name</code> and possible synonyms in an optional <code>synonyms</code> property, Parser 2 requires that there be a single <code>names</code> property with an array of possible verb names.
'''Parser 1 (old) API:'''
  CmdUtils.CreateCommand({
    name: 'find',
    synonyms: ['look-for', 'search'],
    ...
'''Parser 2 (new) API:'''
  CmdUtils.CreateCommand({
    names: ['find', 'look for', 'search'],
    ...
Note also that command names may now include spaces. (Hurray!)


=== Specifying semantic roles ===
=== Specifying semantic roles ===
308

edits

Navigation menu