Lens Scripting API

    Class NlpKeywordModel

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

    Keyword detection (whose results will be returned in VoiceML.NlpKeywordResponse) in the VoiceML.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 ];

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    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

    MMNEPVFCICPMFPCPTTAAATR