ASRClient limitations for ASR testing
Created by: michaelplevy
Issue
ASRClient has limitations that prevent it from exercising an ASR to cover typical IVR usage scenarios. For example, ASRClient in v1.6:
-
Sends a single define-grammar command so it is limited to one grammar. There is no support for multiple grammars (sent as content-type text/uri-list) and no support for weighted grammars (sent as content-type text/grammar-ref-list).
-
Reads grammar files from the file system and sends them to ASR as content-type application/srgs+xml or application/grammar+xml. There is no support for URI grammars such as:
- builtin: used in VXML
- grammars fetched by http: or https: URL
- grammars fetched by file: URIs
- proprietary grammar URI schemes.
-
Does not support common WAV files in RIFF format as audio source
-
Does not support MRCP SET-PARAMS or GET-PARAMS methods. There is no way to change MRCP parameters without changing code, so it can be difficult to test parameterized capabilities of an ASR.
Attached is a patch to address these limitations.
About the patch: All changes made to v1.6 base. Tested on Windows only.
Updated files include:
- platforms\asr-client\src\main.c
- platforms\libasr-client\include\asr_engine.h
- platforms\libasr-client\src\asr_engine.c
- platforms\libasr-client\include\asr_engine_common.h
- data\params_default.txt
Some definitions had moved from asr_engine.h to asr_engine.c. I moved them back because I need them in a shared include.
Broke up original asr_session_file_recognize() into:
- asr_session_file_recognize()
- asr_session_define_grammar() - lets the function be called multiple times
- asr_session_file_recognize_send() - lets us test some stuff in between send and receive and can be exposed in SWIG wrapper
- asr_session_file_recognize_receive() - lets us test some stuff in between send and receive and can be exposed in SWIG wrapper
platforms\libasr-client\include\asr_engine_common.h – these types are broken out into their own .h because I use SWIG to wrap the libasr-client as an API. These structs are helpful and having them in their own .h made SWIG happy.
Data\params_default.txt – a sample parameter file that can be used to replace the default MRCP headers sent in v1.6 of asrclient.
run grammar.xml one-8kHz.pcm uni2 params_default.txt
Should work as the previous versions ASRClient
And I have one question about the source for libasr-client. Are these functions ever used? Should they be removed?
- ASR_CLIENT_DECLARE(const char*) asr_session_stream_recognize()
- ASR_CLIENT_DECLARE(apt_bool_t) asr_session_stream_write()