File: classlm2fst.py

package info (click to toggle)
sphinxtrain 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32,572 kB
  • sloc: ansic: 94,052; perl: 8,939; python: 6,702; cpp: 2,044; makefile: 6
file content (24 lines) | stat: -rw-r--r-- 550 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3

# Copyright (c) 2010  Carnegie Mellon University
#
# You may copy and modify this freely under the same terms as
# Sphinx-III

"""
FST utility functions
"""

__author__ = "David Huggins-Daines <dhdaines@gmail.com>"
__version__ = "$Revision $"

import sphinxbase
from . import fstutils
import openfst
import sys

if __name__ == '__main__':
    lmfile, probdef = sys.argv[1:]
    lm = sphinxbase.NGramModel(lmfile)
    lmfst = fstutils.build_class_lmfst(lm, probdef, True)
    openfst.StdVectorFst(lmfst).Write(lmfile + ".fst")