Menu

#283 hfst-ol.jar fails with some automata

future
closed
nobody
java (3)
1
2015-04-08
2015-01-06
No

Java lookup doesn't seem to load all automata:

$ CLASSPATH=$HOME/Koodit/hfst-optimized-lookup-java/hfst-ol.jar:. java com.googlecode.omorfi.Omorfi
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 32434
at java.util.Vector.get(Vector.java:721)
at net.sf.hfst.WeightedTransducer.<init>(Unknown Source)
at com.googlecode.omorfi.Omorfi.load(Omorfi.java:86)
at com.googlecode.omorfi.Omorfi.loadAll(Omorfi.java:140)
at com.googlecode.omorfi.Omorfi.loadAll(Omorfi.java:163)
at com.googlecode.omorfi.Omorfi.main(Omorfi.java:299)
$ java -jar ../../../hfst-optimized-lookup-java/hfst-ol.jar     ../generated/omorfi.lemmatise.hfst 
Reading header...
Reading alphabet...
Reading transition and index tables...
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 32434
at java.util.Vector.get(Vector.java:721)
at net.sf.hfst.WeightedTransducer.<init>(Unknown Source)
at net.sf.hfst.HfstOptimizedLookup.main(Unknown Source)
$ hfst-lookup ../generated/omorfi.lemmatise.hfst 
hfst-lookup: warning: It is not possible to perform fast lookups with OpenFST, std arc, tropical semiring format automata.
Using HFST basic transducer format and performing slow lookups
> talossa
talossa talo    0,000000

Java interface would be useful for android-based demonstrations.

Discussion

  • Sam Hardwick

    Sam Hardwick - 2015-01-12

    I think this is not a bug.

    The incorrect expectation is either that hfst-optimized-lookup-java handles all kinds of hfst transducers (it only handles optimized-lookup ones) or that the file in question is in optimized-lookup format. The message from hfst-lookup indicates that it isn't, and my own build of current (gitted) omorfi produces lemmatize.default.hfst, which gives the same error message as this report but works when converted to optimized-lookup.

    The real bug is perhaps that hfst-optimized-lookup-java doesn't make any effort to detect when it is supplied with the wrong kind of file...

     
  • Flammie Pirinen

    Flammie Pirinen - 2015-01-13

    oh right of course. I keep forgetting all that, especially since corresponding python code worked neatly but I realise I've been using the swig interface there all along. fwiw I've been working on lexical-as-top branch that may be the next master soon-ish.

     

    Last edit: Flammie Pirinen 2015-01-13
  • Erik Axelson

    Erik Axelson - 2015-04-08
    • status: open --> closed