We do not support rules modification, you can create another grammar and load it, it should be lightweight operation. Or you can preload many grammars and switch between them.
Last edit: Nickolay V. Shmyrev 2015-06-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, thanks. Would it be hard to add support for it? I'm looking at the ps_add_word method and was thinking I could make its counter-part.
How about dictionary modification? Is it possible to remove a word from the dictionary in runtime?
I'm facing a problem where two words are in conflict. One of them is always preferred, no matter how good pronunciation. Given a context in the application, this bias could easily be avoided by removing the unexpected word(s).
Last edit: Kristoffer 2015-06-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You probably need to rethink your application design. You can just add two different pronunciations for the same word if there are indeed two different pronunciations. There is no need to remove something from the dictionary. You can add separate word like "hello_1" and "hello_2" if you still want to keep words separate and just use appropriate variant in the grammar.
It is also not very helpful to restrict grammar too much, it is usually better to make it more relaxed so that user can input different words. User might say something different, it will not follow exactly your expectations. Few additional words do not hurt the accuracy while if you miss something it might be really bad for the user experience.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need to enable/disable rules in my JSGF grammar in runtime. How can I accomplish this in pocketsphinx?
Currently, I load grammar using the addGrammarSearch() method, but I see no way of retrieving the grammar or somehow modify/recompile it. Ideas?
We do not support rules modification, you can create another grammar and load it, it should be lightweight operation. Or you can preload many grammars and switch between them.
Last edit: Nickolay V. Shmyrev 2015-06-21
Ok, thanks. Would it be hard to add support for it? I'm looking at the ps_add_word method and was thinking I could make its counter-part.
How about dictionary modification? Is it possible to remove a word from the dictionary in runtime?
I'm facing a problem where two words are in conflict. One of them is always preferred, no matter how good pronunciation. Given a context in the application, this bias could easily be avoided by removing the unexpected word(s).
Last edit: Kristoffer 2015-06-21
You probably need to rethink your application design. You can just add two different pronunciations for the same word if there are indeed two different pronunciations. There is no need to remove something from the dictionary. You can add separate word like "hello_1" and "hello_2" if you still want to keep words separate and just use appropriate variant in the grammar.
It is also not very helpful to restrict grammar too much, it is usually better to make it more relaxed so that user can input different words. User might say something different, it will not follow exactly your expectations. Few additional words do not hurt the accuracy while if you miss something it might be really bad for the user experience.