Javascript FST results are different from the plain FST results
wincentbalin opened this issue · comments
When testing the FST in the file babyfst-2020.foma
from the repository https://github.com/asahala/BabyFST the suggested test cases
šarru
kaspam
iddin
return when running flookup babyfst-2020.foma < input.txt
šarru šarru+AJ=Masc+Sg+Nom
šarru šarāru+V+G+Stat=3Sg=Masc+Subjunct
šarru šarāru+V+G+Stat=3Sg=Masc+Subjunct+Vent
šarru šarāru+V+G+Stat=3Sg=Masc
šarru šarāru+V+G+Stat=3Sg=Masc+Vent
šarru šarāru+V+G+Vadj+Sg+Nom
šarru šarru+N=Masc+Sg+Nom
šarru šerru+N=Masc+Sg+Nom
kaspam kaspu+N=Masc+Sg+Acc
kaspam kaspu+AJ=Masc+Sg+Acc
kaspam kasāpu+V+G+Stat=3Sg=Masc+Vent
kaspam kasāpu+V+G+Imp=2Sg=Masc+Vent
kaspam kasāpu+V+G+Vadj+Sg+Acc
iddin nadānu+V+G+Prt=3Sg=Masc
iddin nadānu+V+G+Prt=3Sg=Fem
iddin nadānu+V+Gt+Imp=2Sg=Masc
Instead, after converting the file babyfst-2020.foma
to Javascript using command python3 ./foma2js.py -n BabyFST babyfst-2020.fomabin > babyfst.js
and creating a web page with babyfst.js
and foma_apply_down.js
, running foma_apply_down(BabyFST, 'iddin')
results in an empty array.
A file converted using the original Perl script foma2js.perl
yielded the same result.
Current test web page is here: https://wincentbalin.github.io/BabyFST
@mhulden, is it possible to debug a (rather large) FST state-by-state using for example flookup
? I would like to compare resuting paths with flookup
vs. with foma_apply_down.js
.
The error was on my side: flookup
applies up, whereas foma_apply_down.js
applies down (even the names tell that!). I inverted the FST and then it returned results almost as expected.
The output of foma_apply_down.js
still differs from the output of flookup
as described in the README of BabyFST: https://github.com/asahala/BabyFST. For example, the input iddin
returns only nadānu+V+Gt+Imp=2Sg=Masc
with foma_apply_down.js
, but
nadānu+V+Gt+Imp=2Sg=Masc
nadānu+V+G+Prt=3Sg=Masc
nadānu+V+G+Prt=3Sg=Fem
with flookup
.
Because of different outputs I will not close this issue.
Note that there is a bug in foma2js.py
which causes it to omit symbols in the alphabet, which may be the cause of your problem. Can you test with the fixed version from #156 ?
Dear @dhdaines, I have seen your solution already, and I will test it in a couple of days.