TerminalsBegin and TerminalsEnd provide access to the "terminals" of the tree. Terminals are the words and phrases in your grammar, so a TerminalIterator gives you access the the exact words the engine heard a speaker say to match a grammar, in the order that the engine heard those words.
Function
- LVParseTree::TerminalIterator TerminalsBegin()
LVParseTree::TerminalIterator TerminalsEnd()
Example
The following code prints out the sentence engine heard, with a word-level confidence score attached to each word.
LVParseTree::TerminalIterator Itr = Tree.TerminalsBegin();
LVParseTree::TerminalIterator End = Tree.TerminalsEnd();
for (; Itr != End; ++Itr)
{
cout << "\"" << Itr->Text() << "\":(" << Itr->Score() << ") ";
}
cout << endl;
So if the grammar being used was the top level navigation example grammar, and the engine recognized "go back", then the output of the above code might look like:
"go":(850) "back":(901)
See Also