Description

NlpKeywordResponse will be returned if KeywordModel has been supplied as an input model in the ListeningOptions. The keyword model allows detection of keywords (or short phrases) in an input audio.

Example

//@input Asset.VoiceMLModule vmlModule

var onUpdateListeningEventHandler = function(eventArgs){
var keywordResponses = eventArgs.getKeywordResponses();

var nlpResponseText = "";
for (var kIterator = 0; kIterator < keywordResponses.length; kIterator++){
var keywordResponse = keywordResponses[kIterator];
nlpResponseText += "Keyword Response: " + keywordResponse.modelName + "\n keywords: ";
for (var keywordsIterator = 0; keywordsIterator < keywordResponse.keywords.length; keywordsIterator++){
nlpResponseText += keywordResponse.keywords[keywordsIterator] + " ";
}

nlpResponseText += "\n\n";
}
}

script.vmlModule.onListeningUpdate.add(onUpdateListeningEventHandler);
interface NlpKeywordResponse {
    additionalParams: AdditionalParam[];
    keywords: string[];
    modelName: string;
    status: NlpResponseStatus;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
}

Hierarchy (view full)

Properties

additionalParams: AdditionalParam[]

Description

Additional params to send in the response.

keywords: string[]

Description

The keywords detected by the NLP keyword detection model. In addition, the following values could be returned:

#SNAP_ERROR_INCONCLUSIVE: two or more intents detected. #SNAP_ERROR_INDECISIVE: no intent detected. #SNAP_ERROR_NONVERBAL: no transcribable human voice was detected. #SNAP_ERROR_SILENCE: silence was detected.

Anything starting with #SNAP_ERROR_: Errors that are not currently defined in this documentation and should be ignored

modelName: string

Description

Name of the model that sent the response. In current studio release, you can expect the result to contain either VOICE_ENABLED_UI like described in NlpModel. If using enableSystemCommands(), SYSTEM_COMMANDS will be returned as well.

Description

The status of the NLP response. in case of successful result, the value should be VoiceMLModule.NlpResponsesStatusCodes.OK, in case of failure, the value should be VoiceMLModule.NlpResponsesStatusCodes.ERROR.

Methods

  • Parameters

    • type: string

    Returns boolean

    Description

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

  • Parameters

    Returns boolean

    Description

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

Generated using TypeDoc