Getting the Return Value
SI Script by Example showed how grammar tags build a semantic interpretation result. That result is only useful once your application can read it, and Capacity Private Cloud exposes it in two forms. The first is an XML fragment representation of the return value, which follows the W3C's scheme for generating XML from semantic interpretation results — with one difference: the fragment is not wrapped in a top-level element. The second is a programmatic API that returns the value as a data structure.
Under the XML scheme, matching "four hundred and six" with the example grammar from that article produces:
| <number>406</number> <text>FOUR HUNDRED AND SIX</text> |
To read the result through the API:
- After the decode, call
GetNumberOfInterpretationsto find how many interpretations were produced. There is usually one, but an ambiguous grammar can return several. - For each one, call
GetInterpretationto retrieve the interpretation result.
More options are available for more complex interpretations; see the LVInterpretation reference for details.
