kaldi.tfrnnlm

Classes

KaldiTfRnnlmWrapper TensorFlow RNNLM wrapper.
KaldiTfRnnlmWrapperOpts Options for TensorFlow RNNLM wrapper.
TfRnnlmDeterministicFst Deterministic on demand Tensorflow RNNLM FST.
class kaldi.tfrnnlm.KaldiTfRnnlmWrapper

TensorFlow RNNLM wrapper.

This class wraps the TensorFlow based RNNLM, and provides a set of interfaces to be used by TfRnnlmDeterministicFst.

Parameters:
  • opts (KaldiTfRnnlmWrapperOpts) – Options for TensorFlow RNNLM wrapper.
  • rnn_wordlist (str) – The word-list file. Every line should be in the format “[int-word-id] [word]”. The word <oos> must appear in this file.
  • word_symbol_table_rxfilename (str) – Standard word-list file in OpenFST style.
  • unk_prob_file (str) – Unknown probability file. It has the format “[word] [prob or count]”. The probabilities are automatically normalized.
  • tf_model_path (str) – The location of the TensorFlow model.
class kaldi.tfrnnlm.KaldiTfRnnlmWrapperOpts

Options for TensorFlow RNNLM wrapper.

num_threads

Number of threads.

register(opts:OptionsItf)

Registers options with an object implementing the options interface.

Parameters:opts (OptionsItf) – An object implementing the options interface. Typically a command-line option parser.
unk_symbol

Symbol for unknown words.

class kaldi.tfrnnlm.TfRnnlmDeterministicFst

Deterministic on demand Tensorflow RNNLM FST.

Parameters:
clear()

Clears the internal maps.

This method is similar to the destructor but we retain the 0-th entries in each map which corresponds to the <bos> state.

final(state:int) → TropicalWeight

Returns the final weight of the given state.

get_arc(s:int, ilabel:int) -> (success:bool, oarc:StdArc)

Creates an on demand arc and returns it.

Parameters:
  • s (int) – State index.
  • ilabel (int) – Arc label.
Returns:

The created arc.

start() → int

Returns the start state index.