Pankaj-Baranwal / pocketsphinx

Updated ROS bindings to pocketsphinx
BSD 3-Clause "New" or "Revised" License
38 stars 25 forks source link

set_kws_threshold.py: Multiple words in keyphrase IndexError #7

Closed addyi closed 6 years ago

addyi commented 6 years ago

Hi,

I have a problem with your set_kws_threshold.py script. If I use it with the following dictionary and keyword file I get an IndexError.

keyword file:

oh mighty computer /1e-49/
hello world /1e-49/
other phrase /1e-49/
go to one /1e-49/
go to two /1e-49/
go to three /1e-49/
go to four /1e-49/
go to five /1e-49/
start recording /1e-49/
stop recording /1e-49/
cancel recording /1e-49/
open camera /1e-49/
close camera /1e-49/
new action /1e-49/
new location /1e-49/
remember this /1e-49/
next screen /1e-49/
previous screen /1e-49/

dictionary:

oh OW
mighty M AY T IY
computer K AH M P Y UW T ER
hello HH AH L OW
hello(2) HH EH L OW
world W ER L D
other AH DH ER
phrase F R EY Z
go G OW
to T UW
to(2) T IH
to(3) T AH
one W AH N
two T UW
three TH R IY
four F AO R
five F AY V
start S T AA R T
recording R AH K AO R D IH NG
recording(2) R IH K AO R D IH NG
stop S T AA P
cancel K AE N S AH L
open OW P AH N
camera K AE M ER AH
close K L OW S
close(2) K L OW Z
new N UW
new(2) N Y UW
action AE K SH AH N
location L OW K EY SH AH N
remember R IH M EH M B ER
remember(2) R IY M EH M B ER
this DH IH S
next N EH K S T
previous P R IY V IY AH S
screen S K R IY N

IndexError

['oh mighty computer', 'hello world', 'other phrase', 'go to one', 'go to two', 'go to three', 'go to four', 'go to five', 'start recording', 'stop recording', 'cancel recording', 'open camera', 'close camera', 'new action', 'new location', 'remember this', 'next screen', 'previous screen']
Traceback (most recent call last):
  File "set_kws_threshold.py", line 301, in <module>
    preprocess_files(DIC_FILE, KWLIST_FILE)
  File "set_kws_threshold.py", line 54, in preprocess_files
    spaces = _content[indices[0]].count(' ') + spaces + 1
IndexError: list index out of range

Sorry to bother you with such a little problem, but I don't know python and that is why the error causing line exceeds my knowledge. But the line causes a problem, so you should probably know anyway.

BTW: The demo you've provided worked for me, so there should be no problem with my setup.

Thx for the work at cmusphinx :+1: Have a nice day :wave:

addyi

addyi commented 6 years ago

Nevermind, I've used spaces instead of tabs in my dictionary