Every time I call
recognizer.startRecognition(new FileInputStream(filePath));
it loads the language model and that takes a lot of time.
How can I load the language model only once?
Every time I call
recognizer.startRecognition(new FileInputStream(filePath));
it loads the language model and that takes a lot of time.
How can I load the language model only once?
This is not possible at the moment, because the API above is a wrapper on top of a legacy code which is fully stateful and highly coupled. It might be possible to hack the code and make the model load once, but it's quite an amount of work, which nobody is going to do without a strong reason. In the future, I think, the legacy API will go away and the whole code will become as stateless as possible, although in ASR it's natural for a lot of components to store their state.