def main(fst_path, string):
    fst = FST(fst_path)
    s = string.replace("<noise>", "%")
    subst = {"^": "<bol>", "$": "<eol>", " ": "<spc>", "%": "<noise>"}
    fst.explain([subst.get(c, c) for c in s])
Example #2
0
#!/usr/bin/env python
"""
explain_lm FST UTT

Explain the cost assigned to an utternace  UTT by the fst FST.
"""

import sys

from lvsr.ops import FST

fst = FST(sys.argv[1])
s = sys.argv[2]
s = s.replace('<noise>', '%')
subst = {' ': '<spc>', '%': '<noise>'}
fst.explain([subst.get(c, c) for c in s])
def main(fst_path, string):
    fst = FST(fst_path)
    s = string.replace('<noise>', '%')
    subst = {'^': '<bol>', '$': '<eol>', ' ': '<spc>', '%': '<noise>'}
    fst.explain([subst.get(c, c) for c in s])