File: hfst-determinize.py

package info (click to toggle)
hfst 3.16.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,532 kB
  • sloc: cpp: 101,875; sh: 6,717; python: 5,225; yacc: 4,985; lex: 2,900; makefile: 2,017; xml: 6
file content (18 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import hfst
import hfst_commandline
options = hfst_commandline.hfst_getopt('',[],1)

if len(options[1]) == 0:
    raise RuntimeError('Usage: hfst-determinize.py INFILE')

istr = hfst.HfstInputStream(options[1][0])
ostr = hfst.HfstOutputStream(type=istr.get_type())

while(not istr.is_eof()):
    tr = istr.read()
    tr.determinize()
    tr.write(ostr)
    ostr.flush()

istr.close()
ostr.close()