java.lang.ArrayIndexOutOfBoundsException
See original GitHub issueI’m using to parse a given text using the following command.
scripts/PARSE.sh < ../text.in > ../text.out 2> output_file.err
The model that I was trying to use was LDC2014T12. But I get the following error.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at edu.cmu.lti.nlp.amr.AMRParser$$anonfun$main$3.apply(AMRParser.scala:307) at edu.cmu.lti.nlp.amr.AMRParser$$anonfun$main$3.apply(AMRParser.scala:192) at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772) at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33) at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108) at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771) at edu.cmu.lti.nlp.amr.AMRParser$.main(AMRParser.scala:192) at edu.cmu.lti.nlp.amr.AMRParser.main(AMRParser.scala)
I tried using other models given. But the same error occurred.
I tried using scripts/EVAL.sh
also. It also gave the same error.
Any help…?
Thanks…
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top GitHub Comments
The problem is that AMRParser tries to read a tokenization file that doesn’t exist. It seems that instead of raising an exception this results in an empty array. This happens in line 169 of AMRParser.scala:
val tokenized = fromFile(options('tokenized).asInstanceOf[String]).getLines/.map(x => x)/.toArray
Trying to access an element of this empty array in line 197 causes an exception which gets handled, but during handling there is another attempted access in line 307, which causes the ArrayIndexOutOfBoundsException.
As a simple workaround in case your input text is already whitespace tokenized, you can replace line 169 with this line, run ./compile again, and everything should work:
val tokenized = input
Alternatively, you could try to run the tokenize script manually and set the --tok environment variable in config.sh
@calliwen I don’t know how much this helps, but I am now seeing what others are, where commenting out the line of Perl I suggest above is not enough to fix it. We have two otherwise identical machines where one works and the other doesn’t, and we haven’t been able to sort out the difference.
However, in your case, I think this is the most important error:
If you comment out line 149 of that file, does the problem go away?