kensho-technologies / pyctcdecode

A fast and lightweight python-based CTC beam search decoder for speech recognition.
Apache License 2.0
416 stars 89 forks source link

Need better support for alternative language models #69

Closed lopez86 closed 1 year ago

lopez86 commented 2 years ago

Currently, the package includes an abstract language model class, but the decoder class assumes that a kenlm model is being used (type hints use kenlm states). This should be changed to be more generic to better support extending with any alternative language models that can be wrapped in something using the abstract language model class.

A simple way to help do this is to also make an abstract LM state class that is paired with the language model class.

In order to support things like the multi-LM model, I think this should be done with abstract classes rather than generics. This would require runtime type checks that the states match the models, but that should be a very minor cost