stanojevic / beer

Machine Translation Evaluation Metric
Apache License 2.0
38 stars 6 forks source link

Exception in thread "main" java.util.NoSuchElementException #1

Open npecheux opened 8 years ago

npecheux commented 8 years ago

Hi Milos,

When running BEER to evaluate French-to-English or German-to-English, I got an error in some situations. This only happens for some files, not all of them an not for other translation directions. I have not been able to find an explanation nor a way to correct this. I tried with --norm, --NoPunct and/or --NoLower options as well, but nothing changed.

I ran:

./beer --lang en --verbose -r ref -s out

ref and out files are attached.

beer_error_minimal_example.tar.gz

Here is the log (with --verbose)

Loading beer.alignment.MeteorAligner . . . DONE

LOAD LEARNER FROM /people/pecheux/src/beer/models/en_func_exact_para_stem_syn_dep_weka MADE OF beer.learningToRank.Weka@479d31f3

Loading beer.ingredients.DependencyMatching . . . Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0.9 sec]. Loading depparse model file: edu/stanford/nlp/models/parser/nndep/english_SD.gz ... PreComputed 100000, Elapsed Time: 1.969 (s) Initializing dependency parser done [5.9 sec]. DONE Loading beer.ingredients.Kendall . . . DONE Loading beer.ingredients.KendallScaled . . . DONE Loading beer.ingredients.PETcount . . . DONE Loading beer.ingredients.PETnodes . . . DONE Loading beer.ingredients.CharNGrams . . . DONE Loading beer.ingredients.FunctionAndContentWordsCoverage . . . DONE Loading beer.ingredients.WordMatchingCoverage . . . DONE Exception in thread "main" java.util.NoSuchElementException at edu.stanford.nlp.process.DocumentPreprocessor$PlainTextIterator.next(DocumentPreprocessor.java:373) at edu.stanford.nlp.process.DocumentPreprocessor$PlainTextIterator.next(DocumentPreprocessor.java:227) at beer.ingredients.DependencyMatching$.parse(DependencyMatching.scala:196) at beer.ingredients.DependencyMatching.eval(DependencyMatching.scala:22) at beer.BEER$$anonfun$6$$anonfun$7.apply(BEER.scala:64) at beer.BEER$$anonfun$6$$anonfun$7.apply(BEER.scala:64) at scala.collection.immutable.List.map(List.scala:276) at beer.BEER$$anonfun$6.apply(BEER.scala:64) at beer.BEER$$anonfun$6.apply(BEER.scala:63) at beer.BEER.directFactorsAndTokens(BEER.scala:240) at beer.BEER.factorsAndTokens(BEER.scala:223) at beer.Evaluation$$anonfun$evaluate$2$$anonfun$apply$5.apply(Evaluation.scala:120) at beer.Evaluation$$anonfun$evaluate$2$$anonfun$apply$5.apply(Evaluation.scala:119) at scala.collection.immutable.List.foreach(List.scala:381) at beer.Evaluation$$anonfun$evaluate$2.apply(Evaluation.scala:119) at beer.Evaluation$$anonfun$evaluate$2.apply(Evaluation.scala:107) at scala.collection.immutable.List.foreach(List.scala:381) at beer.Evaluation$.evaluate(Evaluation.scala:107) at beer.Evaluation$.main(Evaluation.scala:23) at beer.Evaluation.main(Evaluation.scala)

stanojevic commented 8 years ago

Hi,

That is some error that comes from Stanford parser that is used for syntactic features. I have no idea why that parser doesn't like input sometimes. It could be something with the encoding or weird characters.

You can still use BEER without syntactic features that works almost equally good. To do that add parameters --modelType evaluationNoSyntax on the command line (this trick works only with evaluation of English but also that is the only case when you need it).

If you want this to be the default behaviour of BEER then in the configuration.yaml remove line evaluation: $BEER/models/en_func_exact_para_stem_syn_dep_weka and change evaluationNoSyntax to evaluation.

Thank you for reporting this. I will try to make this more clear in the documentation.

Milos