class montreal_forced_aligner.g2p.generator.Rewriter(fst, input_token_type, phone_symbol_table, num_pronunciations=0, threshold=1, graphemes=None, strict=False)[source]#

Bases: object

Helper object for rewriting

  • fst (pynini.Fst) – G2P FST model

  • input_token_type (pynini.TokenType) – Grapheme symbol table or “utf8”

  • output_token_type (pynini.SymbolTable) – Phone symbol table

  • num_pronunciations (int) – Number of pronunciations, default to 0. If this is 0, thresholding is used

  • threshold (float) – Threshold to use for pruning rewrite lattice, defaults to 1.5, only used if num_pronunciations is 0