Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript FST results are different from the plain FST results #144

Open
wincentbalin opened this issue Dec 29, 2022 · 6 comments
Open

Comments

@wincentbalin
Copy link
Contributor

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.

@wincentbalin
Copy link
Contributor Author

Current test web page is here: https://wincentbalin.github.io/BabyFST

@wincentbalin
Copy link
Contributor Author

@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.

@wincentbalin
Copy link
Contributor Author

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.

@dhdaines
Copy link

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 ?

@wincentbalin
Copy link
Contributor Author

Dear @dhdaines, I have seen your solution already, and I will test it in a couple of days.

@wincentbalin
Copy link
Contributor Author

Dear @dhdaines, at last I did execute the foma2js.py from #156, but sadly the problem with idinustill persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants