A Phrase
contains a chunk of text intended to be said or listened by the robot.
Unlike in English grammar, this sequence of words does not necessarily need
to have a meaning by itself.
See also API doc: Phrase.
A PhraseSet
contains several Phrases
. It is usually used to group
variants and synonyms.
See also API doc: PhraseSet.
Create a Phrase
with a String
and use it to build a Say:
Phrase phrase = new Phrase("Hello")
val say: Say = SayBuilder.with(qiContext)
.withPhrase(phrase)
.build()
say.run()
Phrase phrase = new Phrase("Hello");
Say say = SayBuilder.with(qiContext)
.withPhrase(phrase)
.build();
say.run();
Use a PhraseSet
to build a Listen:
val phraseSet: PhraseSet = PhraseSetBuilder.with(qiContext)
.withTexts("Hello", "Hi")
.build()
val listen: Listen = ListenBuilder.with(qiContext)
.withPhraseSet(phraseSet)
.build()
listen.run()
PhraseSet phraseSet = PhraseSetBuilder.with(qiContext)
.withTexts("Hello", "Hi")
.build();
Listen listen = ListenBuilder.with(qiContext)
.withPhraseSet(phraseSet)
.build();
listen.run();
Retrieve the heard Phrase
and the corresponding PhraseSet
from
a ListenResult
:
val listenResult: ListenResult = ...
val heardPhrase: Phrase = listenResult.heardPhrase
val matchedPhraseSet: PhraseSet = listenResult.matchedPhraseSet
ListenResult listenResult = ...;
Phrase heardPhrase = listenResult.getHeardPhrase();
PhraseSet matchedPhraseSet = listenResult.getMatchedPhraseSet();
See also API doc: ListenResult.