openFST - beyondnlp/nlp GitHub Wiki
openFST
-
http://www.openfst.org/twiki/pub/FST/FstHltTutorial/tutorial_part2.pdf
-
http://www.openfst.org/twiki/pub/FST/FstHltTutorial/tutorial_part3.pdf
-
WFST๋ฅผ ๊ตฌํํ๊ธฐ ์ํด์๋ openfst๋ฅผ ์ฌ์ฉํ ์ ์์ด์ผ ํ๋ค.
-
์คํ์์ค์ด๊ธฐ๋ ํ๊ณ ์ฌ์ฉ๋ฒ ์ญ์ ๊ฐ๋จํ๋ค.
openFST format( AT&T ํฌ๋งท์ ๊ธฐ๋ณธ์ผ๋ก ํ๋ค )
-
arc format
- src dest ilabel olabel [weight]
-
final state : state [weight]
-
test.fst
-
Transducer File (T.txt):
0 1 a x 0.5
0 1 b y 1.5
1 2 c z 2.5
2 3.5
- Input Symbols File (T.isyms):
a 1
b 2
c 3
- Output Symbols File (T.osyms):
x 1
y 2
z 3
- Compiling : T.fst ๋ฐ์ด๋๋ฆฌ ํํ๋ก ์ปดํ์ผ
- fstcompile -isymbols=T.isyms -osymbols=T.osyms T.txt T.fst
- Printing
- fstprint -isymbols=T.isyms -osymbols=T.osyms T.fst >T.txt
- Drawing : dot ํ์ผ๋ก ๋ง๋ค์ด์ ํ๋ฉด์ ์ถ๋ ฅ์ด ๊ฐ๋ฅํ๋ค.
- fstdraw -isymbols=T.isyms -osymbols=T.osyms T.fst >T.dot
- Writing
- fst.Write(โโT.fstโโ)
Example: FST Application - Shell-Level
* fstarcsort --sort type=olabel input.fst input sorted.fst
* fstarcsort --sort type=ilabel model.fst model sorted.fst
- Creates the composed FST
* $ fstcompose input sorted.fst model sorted.fst comp.fst
- Just keeps the output label
* $ fstproject --project output comp.fst result.fst
- Do it all in a single command line
* $ fstarcsort --sort type=ilabel model.fst | fstcompose input.fst - | fstproject --project output result.fst