athena.tools.lm_scorer¶
language model scorer used in speech recognition model decoding
Module Contents¶
Classes¶
NGramScorer |
KenLM language model |
RNNScorer |
RNN language model |
-
class
athena.tools.lm_scorer.NGramScorer(lm_path, sos, eos, num_syms, lm_weight=0.1)¶ Bases:
objectKenLM language model
-
reset(self)¶ Call this function to reset the lm to predict on a new sequence
-
score(self, candidate_holder, new_scores)¶ Call this function to compute the NGram score of the next prediction based on historical predictions, the scoring function shares a common interface :param candidate_holder:
Returns: the NGram weighted score cand_states: Return type: score
-
get_score(self, cand_parents, cand_syms, lang_model)¶ the saved lm model will be called here :param cand_parents: last selected top candidates :param cand_syms: last selected top char index :param lang_model: the language model
Returns: the lm scores Return type: scores
-
-
class
athena.tools.lm_scorer.RNNScorer(lm_model, lm_weight=0.1)¶ Bases:
objectRNN language model
-
reset(self)¶ Call this function to reset the lm to predict on a new sequence
-
score(self, candidate_holder, new_scores)¶ Call this function to compute the score of the next prediction based on historical predictions, the scoring function shares a common interface :param candidate_holder:
Returns: the weighted score cand_states: Return type: score
-