Openfst fstcompose for transducing

2019-02-24 19:11发布

Trying to run a FST which i compiled with an input FSA, but when I do there is no output. As I searched, only run command in openfst is fstcompose, so what it try to do is composing the fst with the inputs as fsa.

pronoun.fsm.txt

0   1   <s> <s>
1   0   <eps>   <eps>
0   2   </s>    </s>
2   0   <eps>   <eps>
0   3   <unk>   <unk>
3   0   <eps>   <eps>
0   4   a   a
4   5   l   l
5   6   l   l
6   0   +PRN    #
0

symbols.txt

<eps>   0
<s> 1
</s>    2
<unk>   3
a   4
l   5
+PRN    6
#   7

test.fsm.txt

0 1 a
1 2 l
2 3 l
3 4 +PRN
4

So I created pronoun.fsm.txt as FST

fstcompile --isymbols=symbols.txt --osymbols=symbols.txt pronoun.fsm.txt>pronoun.fst

Then, I created my inputs as acceptor

fstcompile --isymbols=symbols.txt --acceptor=true test.fsm.txt>test.fst

Lastly, I composed both fsts, but the output is nothing.

fstcompose pronoun.fst test.fst|fstprint --isymbols=symbols.txt --osymbols=symbols.txt

Here is the deal, I want to run a string input to a transducer I created with fstcompose command. But the output is blank.

标签: openfst
1条回答
Anthone
2楼-- · 2019-02-24 19:59

I found the problem. I want to answer this question instead of deleting it because OpenFST has really isufficient documentation and this question answers how to run FST on OpenFST. The problem is on fstcompose you have to give your inputs as the first argument. So the solution is

fstcompose test.fst pronoun.fst |fstprint --isymbols=symbols.txt --osymbols=symbols.txt
查看更多
登录 后发表回答