Modules. ASR

ASR module provides speech recognition capabilities, call audio can be sent to the ASR instance. Language or dictionary should be passed to createASR function.

Add the following line to your scenario code to use the module:

require(Modules.ASR);

All functions, events and classes of the module can be used only after this line.

Events

ASREvents.ASRError

Dispatched in case of problems during the recognition process

Properties
  • asr: ASR

    ASR instance that generated the event

  • error: string

    Error message

ASREvents.CaptureStarted

Dispatched after ASR detected voice input and started collecting audio data for ASR

Properties
  • asr: ASR

    ASR instance that generated the event

ASREvents.InterimResult

Dispatched when interim recognition result received from ASR

Properties
  • asr: ASR

    ASR instance that generated the event

  • text: string

    Recognition result

ASREvents.Result

Dispatched when recognition result received from ASR

Properties
  • asr: ASR

    ASR instance that generated the event

  • confidence: number

    Recognition confidence in 0..100 Range (100 means full confidence, 0 - not confident at all)

  • text: string

    Recognition result

ASREvents.SpeechCaptured

Dispatched after ASR captured audio data, before recognition process

Properties
  • asr: ASR

    ASR instance that generated the event

ASREvents.Started

Dispatched after ASR instance was created

Properties
  • asr: ASR

    ASR instance that generated the event

ASREvents.Stopped

Dispatched after ASR stop function call

Properties
  • asr: ASR

    ASR that generated the event

Functions

VoxEngine.createASR(params)

ASR

Create new speech recognizer and start recognition.

Sources can later be attached using Call.sendMediaTo() etc.
Example

	require(Modules.ASR);

	var asr = VoxEngine.createASR({lang:ASRLanguage.ENGLISH_US, dict:["John", "Mike", "Matthew", "Cary"]});
	asr.addEventListener(ASREvents.Result, function(asrevent) {
		asr.stop();
	    if (asrevent.confidence > 50)  {
	    	call.say("Calling "+asrevent.text, Language.US_ENGLISH_FEMALE);
	    	call.addEventListener(CallEvents.PlaybackFinished, VoxEngine.terminate);
	    }
	});
	call.sendMediaTo(asr);
Parameters
Returns

Constants

ASRDictionary.ADDRESS_RU

ASR Russian addresses dictionary

ASRDictionary.ADDRESS_TR

ASR Turkish addresses dictionary

ASRDictionary.CITY_STATE_US

ASR US City/States dictionary

ASRDictionary.DATE

ASR Date dictionary

ASRDictionary.DATE_RU

ASR Russian Date dictionary

ASRDictionary.ECOMMERCE

ASR Buying dictionary

ASRDictionary.MONEY_US

ASR US Money dictionary

ASRDictionary.MUSIC

ASR Music dictionary

ASRDictionary.NAMES_RU

ASR Russian Names dictionary

ASRDictionary.NBA

ASR Basketball Teams dictionary

ASRDictionary.NFL

ASR Football Teams dictionary

ASRDictionary.NOTES

ASR Notes dictionary

ASRDictionary.NUMBERS_RU

ASR Russian Numbers dictionary

ASRDictionary.NUMBERS_TO_9

ASR Numbers to 9 dictionary

ASRDictionary.NUMBERS_TO_99

ASR Numbers to 99 dictionary

ASRDictionary.NUMBERS_TO_999

ASR Numbers to 999 dictionary

ASRDictionary.PHONE_NUMBER

ASR Phone Number dictionary

ASRDictionary.QUESTIONNAIRE_RU

ASR Russian Questionnaire dictionary

ASRDictionary.SEARCH_QUERIES

ASR Queries dictionary

ASRDictionary.SPORTS_TEAMS

ASR Sports Teams dictionary

ASRDictionary.STREETS

ASR Streets dictionary

ASRDictionary.TIME

ASR Time dictionary

ASRLanguage.AFRIKAANS_ZA

Afrikaans (South Africa)

ASRLanguage.ARABIC_AE

Arabic (U.A.E.)

ASRLanguage.ARABIC_BH

Arabic (Bahrain)

ASRLanguage.ARABIC_DZ

Arabic (Algeria)

ASRLanguage.ARABIC_IL

Arabic (Israel)

ASRLanguage.ARABIC_JO

Arabic (Jordan)

ASRLanguage.ARABIC_KW

Arabic (Kuwait)

ASRLanguage.ARABIC_LB

Arabic (Lebanon)

ASRLanguage.ARABIC_MA

Arabic (Morocco)

ASRLanguage.ARABIC_PS

Arabic (Palestinian)

ASRLanguage.ARABIC_SA

Arabic (Saudi Arabia)

ASRLanguage.ARABIC_TN

Arabic (Tunisia)

ASRLanguage.BULGARIAN_BG

Bulgarian (Bulgaria)

ASRLanguage.CANTONESE_HK

Cantonese, Traditional script, Hong Kong SAR

ASRLanguage.CATALAN_ES

Catalan (Catalan)

ASRLanguage.CHINESE_CN

Chinese (People's Republic of China)

ASRLanguage.CHINESE_HK

Chinese (Hong Kong S.A.R.)

ASRLanguage.CHINESE_TW

Chinese (Taiwan)

ASRLanguage.CROATIAN_HR

Croatian (Croatia)

ASRLanguage.CZECH_CZ

Czech (Czech Republic)

ASRLanguage.DANISH_DK

Danish (Denmark)

ASRLanguage.DUTCH_NL

Dutch (Netherlands)

ASRLanguage.ENGLISH_AU

English (Australia)

ASRLanguage.ENGLISH_CA

English (Canada)

ASRLanguage.ENGLISH_IE

English (Ireland)

ASRLanguage.ENGLISH_IN

English (India)

ASRLanguage.ENGLISH_NZ

English (New Zealand)

ASRLanguage.ENGLISH_PH

English (Philippines)

ASRLanguage.ENGLISH_UK

English (United Kingdom)

ASRLanguage.ENGLISH_US

English (United States)

ASRLanguage.ENGLISH_ZA

English (South Africa)

ASRLanguage.FILIPINO_PH

Filipino (Philippines)

ASRLanguage.FINNISH_FI

Finnish (Finland)

ASRLanguage.FRENCH_CA

French (Canada)

ASRLanguage.FRENCH_FR

French (France)

ASRLanguage.GALICIAN_ES

Galician (Spain)

ASRLanguage.GERMAN_DE

German (Germany)

ASRLanguage.GREEK_GR

Greek (Greece)

ASRLanguage.HEBREW_IL

Hebrew (Israel)

ASRLanguage.HUNGARIAN_HU

Hungarian (Hungary)

ASRLanguage.ICELANDIC_IS

Icelandic (Iceland)

ASRLanguage.INDONESIAN_ID

Indonesian (Indonesia)

ASRLanguage.ITALIAN_IT

Italian (Italy)

ASRLanguage.JAPANESE_JP

Japanese (Japan)

ASRLanguage.LITHUANIAN_LT

Lithuanian (Lithuania)

ASRLanguage.MALAYSIA_MY

Malay (Malaysia)

ASRLanguage.NORWEGIAN_NO

Norwegian (Norway)

ASRLanguage.POLISH_PL

Polish (Poland)

ASRLanguage.PORTUGUESE_BR

Portuguese (Brazil)

ASRLanguage.PORTUGUES_PT

Portuguese (Portugal)

ASRLanguage.ROMANIAN_RO

Romanian (Romania)

ASRLanguage.RUSSIAN_RU

Russian (Russia)

ASRLanguage.SLOVAK_SK

Slovak (Slovakia)

ASRLanguage.SLOVENIAN_SL

Slovenian (Slovenia)

ASRLanguage.SPANISH_AR

Spanish (Argentina)

ASRLanguage.SPANISH_BO

Spanish (Bolivia)

ASRLanguage.SPANISH_CL

Spanish (Chile)

ASRLanguage.SPANISH_CO

Spanish (Colombia)

ASRLanguage.SPANISH_CR

Spanish (Costa Rica)

ASRLanguage.SPANISH_DO

Spanish (Republican Dominican)

ASRLanguage.SPANISH_EC

Spanish (Ecuador)

ASRLanguage.SPANISH_ES

Spanish (Spain)

ASRLanguage.SPANISH_GT

Spanish (Guatemala)

ASRLanguage.SPANISH_HN

Spanish (Honduras)

ASRLanguage.SPANISH_MX

Spanish (Mexico)

ASRLanguage.SPANISH_NI

Spanish (Nicaragua)

ASRLanguage.SPANISH_PA

Spanish (Panama)

ASRLanguage.SPANISH_PR

Spanish (Puerto Rico)

ASRLanguage.SPANISH_PY

Spanish (Paraguay)

ASRLanguage.SPANISH_SV

Spanish (El Salvador)

ASRLanguage.SPANISH_US

Spanish (Estados Unidos)

ASRLanguage.SPANISH_UY

Spanish (Uruguay)

ASRLanguage.SPANISH_VE

Spanish (Venezuela)

ASRLanguage.SWEDISH_SE

Swedish (Sweden)

ASRLanguage.THAI_TH

Thai (Thailand)

ASRLanguage.TURKISH_TR

Turkish (Turkey)

ASRLanguage.UKRAINIAN_UA

Ukrainian (Ukraine)

ASRLanguage.VIETNAMESE_VN

Vietnamese (Viet Nam)

ASRLanguage.ZULU_ZA

Zulu (South Africa)

ASRMicProfile.MOBILE

Microphone in mobile phone

ASRMicProfile.PC

Microphone in PC

Example

	require(Modules.ASR);
	
	var call,
		asr;

	// Inbound call
	VoxEngine.addEventListener(AppEvents.CallAlerting, function (e) { 
		
		call = e.call;
		call.answer();
		call.addEventListener(CallEvents.Connected, handleCallConnected);
		call.addEventListener(CallEvents.Disconnected, VoxEngine.terminate);

	});

	// CallConnected event handler
	function handleCallConnected(callevent) {
		// Play prompt
		call.say("Hi, thanks for calling us! Please choose a color you like - red, blue, yellow or green ", Language.US_ENGLISH_FEMALE);
		// Init ASR - expect US English input and explicitly specified custom dictionary
		asr = VoxEngine.createASR(ASRLanguage.ENGLISH_US, ["red", "blue", "yellow", "green"]);
		// Handle ASREvents.CaptureStarted (fired when system detects voice input and start collecting data for ASR)
		asr.addEventListener(ASREvents.CaptureStarted, function(e) {
				call.stopPlayback();
			});
		// Handle recognition result
		asr.addEventListener(ASREvents.Result, function(asrevent) {
			asr.stop();
		    call.say("You've chosen "+asrevent.text+" color. Confidence is "+asrevent.confidence, Language.US_ENGLISH_FEMALE);
		    call.addEventListener(CallEvents.PlaybackFinished, VoxEngine.terminate);
		});
		// Send call media to ASR instance
		call.sendMediaTo(asr);
	}