cmusphinx / sphinx4

Pure Java speech recognition library
cmusphinx.sourceforge.net
Other
1.4k stars 586 forks source link

context.getInstance(JSGFGrammar.class) breaks assertion #76

Closed timobaumann closed 6 years ago

timobaumann commented 6 years ago

Getting access to the JSGFGrammar in default.config.xml is impossible when running code with assertions switched on.

Given that GrXmlGrammar derives from JSGFGrammar, context.getInstance(JSGFGrammar.class) / and ConfigurationManager.lookup() will find two instances in default.config.xml which then breaks the assertion in line 185 of ConfigurationManager.

I don't know if it's reasonable to check whether the object is of class JSGFGrammar as this would exclude lookup of subclasses. Instead, the fix to this would be to have both JSGF and GrXML grammars derive from some common subclass. I'm happy to provide such a patch.

nshmyrev commented 6 years ago

That would be great, thank you!

nshmyrev commented 6 years ago

Closed with #77

timobaumann commented 6 years ago

Nickolay, I must once more say that it is a pleasure to work with you and that I admire how generously you help the Sphinx project and open-source speech technology as a whole!

nshmyrev commented 6 years ago

You are welcome, Timo, same for me. Hopefully we'll have a chance to grab a beer soon.