Asterisk 1.4 UniMRCP and PocketSphinx

719 views
Skip to first unread message

assanta

unread,
Nov 9, 2010, 5:33:10 AM11/9/10
to UniMRCP
Hi

All works ok with the default installation and the inline grammar

exten => X,n,MRCPRecog(inline:#JSGF V1.0 ISO-8859-1 en-US\\\;grammar
topping\\\; public <topping> = ( one | two | three )\\\;,p=speech-
sphinx-mrcp1&i=any&t=5000&f=&b=1&nit=5000&sct=1000&sint=2000)

but problems with file grammars, grammar file is default from the
initial build.

1) "Completion-Cause: 006 error" if i try with
exten => X,n,MRCPRecog(file:///usr/local/unimrcp/data/
grammar.jsgf,p=speech-sphinx-
mrcp1&i=any&t=5000&f=&b=1&nit=5000&sct=1000&sint=2000)

client log
[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4175 unimrcp_log:
Process Message [speech-sphinx-mrcp1] [1;0]
[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4172 unimrcp_log: Send
RTSP Stream 100.100.100.100.1:34431 <-> 100.100.100.100.1:1554 [392
bytes]
ANNOUNCE rtsp://100.100.100.100.1:1554/media/speechrecognizer RTSP/1.0
CSeq: 2
Session: eb594f767f3d40d3
Content-Type: application/mrcp
Content-Length: 231

RECOGNIZE 1 MRCP/1.0
Content-Type: text/uri-list
Speech-Complete-Timeout: 1000
Recognition-Timeout: 5000
Speech-Incomplete-Timeout: 2000
No-Input-Timeout: 5000
Content-Length: 43

file:///usr/local/unimrcp/data/grammar.jsgf
[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4172 unimrcp_log: Push
RTSP Request to In-Progress Queue 0xb27006b0 <eb594f767f3d40d3> CSeq:2
[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4175 unimrcp_log: Wait
for Messages [speech-sphinx-mrcp1]
[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4175 unimrcp_log:
Process Signalled Descriptor [speech-sphinx-mrcp1]
[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4172 unimrcp_log:
Receive RTSP Stream 100.100.100.100.134431 <-> 100.100.100.100.1:1554
[163 bytes]
RTSP/1.0 200 OK
CSeq: 2
Session: eb594f767f3d40d3
Content-Type: application/mrcp
Content-Length: 56

MRCP/1.0 1 407 COMPLETE
Completion-Cause: 006 error


[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4172 unimrcp_log: Pop In-
Progress RTSP Request 0xb27006b0 CSeq:2
[Nov 9 11:07:26] DEBUG[11333]: app_unimrcp.c:4175 unimrcp_log: Wait
for Messages [speech-sphinx-mrcp1]
[Nov 9 11:07:26] DEBUG[11326]: app_unimrcp.c:4175 unimrcp_log:
Process Message [MRCP Client] [1;2]
[Nov 9 11:07:26] DEBUG[11326]: app_unimrcp.c:4172 unimrcp_log: Raise
App MRCP Response 0xa22bf20 <eb594f767f3d40d3>
[Nov 9 11:07:26] DEBUG[11326]: app_unimrcp.c:3776
recog_on_message_receive: (ASR-16) RECOGNIZE failed: status = 407,
completion-cause = 006
[Nov 9 11:07:26] DEBUG[11326]: app_unimrcp.c:1700
speech_channel_set_state_unlocked: (ASR-16) READY ==> ERROR
[Nov 9 11:07:26] DEBUG[11326]: app_unimrcp.c:4175 unimrcp_log: Wait
for Messages [MRCP Client]
[Nov 9 11:07:26] ERROR[11418]: app_unimrcp.c:5445 app_recog_exec:
Unable to start recognition

server log:
2010-11-09 11:07:26:762929 [INFO] Receive RTSP Stream
100.100.100.1:1554 <-> 100.100.100.1:34431 [392 bytes]
ANNOUNCE rtsp://100.100.100.1:1554/media/speechrecognizer RTSP/1.0
CSeq: 2
Session: eb594f767f3d40d3
Content-Type: application/mrcp
Content-Length: 231

RECOGNIZE 1 MRCP/1.0
Content-Type: text/uri-list
Speech-Complete-Timeout: 1000
Recognition-Timeout: 5000
Speech-Incomplete-Timeout: 2000
No-Input-Timeout: 5000
Content-Length: 43

file:///usr/local/unimrcp/data/grammar.jsgf
2010-11-09 11:07:26:763024 [INFO] Process RECOGNIZE Request
<eb594f767f3d40d3@speechrecog> [1]
2010-11-09 11:07:26:763036 [INFO] Dispatch Request RECOGNIZE
<eb594f767f3d40d3@pocketsphinx>
2010-11-09 11:07:26:763048 [INFO] Process RECOGNIZE Response
<eb594f767f3d40d3@speechrecog> [1]
2010-11-09 11:07:26:763083 [INFO] Send RTSP Stream
100.100.100.1:1554 <-> 100.100.100.1:34431 [163 bytes]
RTSP/1.0 200 OK
CSeq: 2
Session: eb594f767f3d40d3
Content-Type: application/mrcp
Content-Length: 56

MRCP/1.0 1 407 COMPLETE
Completion-Cause: 006 error

2)
"Not Supported Content-Type" If I try with
exten => X,n,MRCPRecog(/usr/local/unimrcp/data/grammar.jsgf,p=speech-
sphinx-mrcp1&i=any&t=5000&f=&b=1&nit=5000&sct=1000&sint=2000)

server log:
2010-11-09 11:05:52:063931 [INFO] Receive RTSP Stream
100.100.100.1:1554 <-> 100.100.100.1:34428 [302 bytes]
ANNOUNCE rtsp://100.100.100.1:1554/media/speechrecognizer RTSP/1.0
CSeq: 2
Session: 32c9f43c7acc404f
Content-Type: application/mrcp
Content-Length: 141

DEFINE-GRAMMAR 1 MRCP/1.0
Content-Type: application/srgs+xml
Content-Id: ASR-13
Content-Length: 36

/usr/local/unimrcp/data/grammar.jsgf
2010-11-09 11:05:52:064006 [INFO] Process DEFINE-GRAMMAR Request
<32c9f43c7acc404f@speechrecog> [1]
2010-11-09 11:05:52:064018 [INFO] Dispatch Request DEFINE-GRAMMAR
<32c9f43c7acc404f@pocketsphinx>
2010-11-09 11:05:52:064025 [WARN] Not Supported Content-Type
[application/srgs+xml] <32c9f43c7acc404f@pocketsphinx>
2010-11-09 11:05:52:064034 [INFO] Process DEFINE-GRAMMAR Response
<32c9f43c7acc404f@speechrecog> [1]
2010-11-09 11:05:52:064077 [INFO] Send RTSP Stream
100.100.100.1:1554 <-> 100.100.100.1:34428 [165 bytes]
RTSP/1.0 200 OK
CSeq: 2
Session: 32c9f43c7acc404f
Content-Type: application/mrcp
Content-Length: 58

MRCP/1.0 1 409 COMPLETE
Completion-Cause: 000 success

Arsen Chaloyan

unread,
Dec 16, 2010, 8:21:11 PM12/16/10
to uni...@googlegroups.com
Hi Assanta,

You're right whatever is intended to work works, the rest isn't
implemented. The PocketSphinx plugin supports inline JSGF grammars
provided either within DEFINE-GRAMMAR or RECOGNIZE requests. It's not
possible to retrieve a grammar by URI (http:// or file://) at the
moment. Perhaps one can easily implement it. See
http://code.google.com/p/unimrcp/source/browse/trunk/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c?r=1791#440

> --
> You received this message because you are subscribed to the Google Groups "UniMRCP" group.
> To post to this group, send email to uni...@googlegroups.com.
> To unsubscribe from this group, send email to unimrcp+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/unimrcp?hl=en.
>
>

--
Arsen Chaloyan
The author of UniMRCP
http://www.unimrcp.org

roko

unread,
Jan 19, 2011, 9:27:14 AM1/19/11
to UniMRCP
Hi Arsen,

This mean that I cannot use pocketsphinx Language Model instead of
using a Grammar ?

Regards,

./roko

On Dec 16 2010, 10:21 pm, Arsen Chaloyan <achalo...@gmail.com> wrote:
> Hi Assanta,
>
> You're right whatever is intended to work works, the rest isn't
> implemented. The PocketSphinx plugin supports inline JSGF grammars
> provided either within DEFINE-GRAMMAR or RECOGNIZE requests. It's not
> possible to retrieve a grammar by URI (http:// or file://) at the
> moment. Perhaps one can easily implement it. Seehttp://code.google.com/p/unimrcp/source/browse/trunk/plugins/mrcp-poc...
>
>

Josef Novak

unread,
Jan 19, 2011, 10:22:08 AM1/19/11
to uni...@googlegroups.com
Hi,
 Looking through the source tree for 'jsgf', it seems to only appear in a couple of places,
http://www.google.com/codesearch?q=jsgf+package%3Ahttp%3A%2F%2Funimrcp\.googlecode\.com&origq=jsgf&btnG=Search+Trunk

 And in mrcp_pocketsphinx.c,
http://code.google.com/p/unimrcp/source/browse/trunk/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c

 It appears to just be loading the jsgf grammar with standard command line options.  You *might* be able to just swap out 'jsgf' for the standard 'lm' command line option in the relevant places in mrcp_pocketsphinx.c and recompile.  This option switch is what you would do just using pocketsphinx alone from the command line.  However I have not actually tried to do this, so it very well might not work.  If it did work, it would be a nasty hack, and you would be stuck with using arpa LMs exclusively rather than jsgf grammars.  Maybe I'll give it a try later this week.
  Finally, for large LMs (say a standard 3gram 64k LVCSR LM) you can expect that it will take some time to load the model, even if it is in the sphinx binary format.
Regards,
 Joe



--

roko

unread,
Jan 19, 2011, 2:35:34 PM1/19/11
to uni...@googlegroups.com
Thanks. If I try it and it is successful, I will post what I did.

roko

unread,
Jan 28, 2011, 1:54:42 PM1/28/11
to UniMRCP
I tried but it doesn't work :-(

I'm working with different configurations and will talk with a
colleague to check the code...

roko

unread,
Feb 2, 2011, 8:03:08 AM2/2/11
to UniMRCP
I tried without the hack and it worked but it seems that maybe I will
need some kind of "hack" to use language models instead of grammars. I
will post later if it works (or not)

roko

unread,
Feb 14, 2011, 2:18:10 PM2/14/11
to uni...@googlegroups.com
Hi,

I change the line 352:

from: "-jsgf", grammar,"
to: "-lm", grammar,

It does not work, but checking unimrcpserver output:
-lm ../data/6809cf40386e11e0-ASR-10.gram \

it seems the this "grammar" variable is a compiled version of the file sent using MRCPRecog function.

Also I can see in unimrcpserver output:

ERROR: "ngram_model_arpa.c", line 76: No \data\ mark in LM file
ERROR: "ngram_model_dmp.c", line 120: Wrong magic header size number 2f757372: ../data/6809cf40386e11e0-ASR-10.gram is not a dump file

My call is:

MRCPRecog(/usr/local/unimrcp/data/test/hub4.5000.DMP,p=speech-pocket-mrcp2&i=any&t=5000&f=hello-world&b=0&nit=5000&sct=1000&sint=2000)

So, my question is:

Which is the variable I need to put in this line number 352 just to have the original path/file used in MRCPRecog ?
I want to use "/usr/local/unimrcp/data/test/hub4.5000.DMP" with "-lm" parameter.

In the MRCP part of the output I can see it:

MRCP/2.0 201 DEFINE-GRAMMAR 1
Channel-Identifier: 6809cf40386e11e0@speechrecog
Content-Type: application/srgs+xml
Content-Id: ASR-10
Content-Length: 42

/usr/local/unimrcp/data/test/hub4.5000.DMP

but I cannot figure it out in the code (I have programming knowledge but I get a little bit lost with C programming)


roko

unread,
Feb 15, 2011, 1:50:27 PM2/15/11
to uni...@googlegroups.com
Hi all.to: "-lm", "/path/to/my/language/model",

grammar variable has the compiled grammar and of course that does not work as a LM (Language Model).

And it worked !

I have a coworker helping me finding the variable that I need to use to avoid the hardcoded nasty hack.

roko

unread,
Feb 25, 2011, 4:30:28 PM2/25/11
to uni...@googlegroups.com
I forgot to mention that I needed to comment these lines in order to avoid the restriction on using only JSFG:

  if(strstr(content_type,"jsgf") == NULL) {
          apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Not Supported Content-Type [%s] "APT_SIDRES_FMT,
                  content_type,RECOGNIZER_SIDRES(recognizer));
          return MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE;
  }


the same file: unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c

Arsen Chaloyan

unread,
Jul 8, 2011, 3:52:05 PM7/8/11
to uni...@googlegroups.com
Hi Robert,

I'm glad you got it working. BTW, if you need this functionality to be
included in the source tree, I'd suggest to try making it configurable
from pocketsphinx.xml

> --
> You received this message because you are subscribed to the Google Groups
> "UniMRCP" group.
> To post to this group, send email to uni...@googlegroups.com.
> To unsubscribe from this group, send email to
> unimrcp+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/unimrcp?hl=en.
>

--
Arsen Chaloyan
Author of UniMRCP
http://www.unimrcp.org

Reply all
Reply to author
Forward
0 new messages