Used to detect usage of certain keywords from the input audio.

Keyword detection (whose results will be returned in NlpKeywordResponse in the ListeningUpdateEventArgs) can happen in the mid input sentence (and in such case the the isFinalTranscription=false) or can happen at the end of the sentence (isFinalTranscription=true). Mid sentence detection have closer proximity to the time the word was spoken, but might be less accurate.

var options = VoiceML.ListeningOptions.create();

var nlpKeywordModel = VoiceML.NlpKeywordModelOptions.create();
nlpKeywordModel.addKeywordGroup("fruit", ["orange", "apple"]);
nlpKeywordModel.addKeywordGroup("vegetable", ["carrot", "tomato"]);

options.nlpModels = [ nlpKeywordModel ];
interface NlpKeywordModel {
    keywordGroups: KeywordModelGroup[];
    addKeywordGroup(name: string, keywords: string[]): void;
    addParam(key: string, value: string): void;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
}

Hierarchy (view full)

Properties

keywordGroups: KeywordModelGroup[]

Holds group of keywords to be used in the ML model.

Methods

  • Adds a keyword group to the keywords model, the group name will be returned in NlpKeywordResponse to indicate one of the keywords in the group has been detected. Groups are used to include synonyms, or context similar words. addKeywordGroup("walk", ["walk", "jog", "strolls"]).

    Parameters

    • name: string
    • keywords: string[]

    Returns void

  • Adds additional params to set in the ML engine.

    Parameters

    • key: string
    • value: string

    Returns void

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean