Java Stanford NLP: ArrayIndexOutOfBounds after loading second lexicon -


I am using the Stanford Natural Language Resource Toolkit. I am trying to find spelling errors with the lexicon method of isKnown , but it generates a lot of false positives, so I thought I could load a second dictionary I'll do it, and check that too. However, this causes a problem.

  Private static lexicalized parser LP = new lexicalized parser (constants.steadxfile); Private stable lexicalized parser wsjLexParse = new lexicalized parser (Constants.wsjLexFile); Stable {lp.setOptionFlags (Constants.lexOptionFlags); WsjLexParse.setOptionFlags (Constants.lexOptionFlags); } Public Pursession (string input) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {Initial input = input; DocumentPreprocessor Process = New DocumentPreprocessor (); Sentence = Process .getSentencesFromText (New StringReader (Input)); For (list & lt ;; HasWord is extended; Sent: Sentence) {if (lp.parse ()) {// line 65 forest.add (lp.getBestParse ()); // Non-fatalism? }} PartsOfSpeech = pos (); RunAnalysis (); }  

The following unsuccessful trace is generated:

  java.lang.ArrayIndexOutOfBoundsException: 45547 at edu.stanford.nlp.parser.lexparser.BaseLexicon.initRulesWithWord on edu.stanford.nlp.parser.lexparser.BaseLexicon.ruleIteratorByWord (BaseLexicon.java:212) on edu.stanford.nlp.parser.lexparser.BaseLexicon.isKnown (BaseLexicon.java:160) (BaseLexicon.java:300) Edu.stanford.nlp.parser.lexparser.ExhaustivePCFGParser.initializeChart (Exposive PCFGPR. Java.1299) edu.stanford.nlp.parser.lexparser at. Exstic PCF Jeepers PRS (Exclusive PCFGepers Java .8) edu.stanford.nlp.parser. Nth.compling.ParseTree at lexparser.LexicalizedParser.parse & lt (LexicalizedParser.java:234) ;. Init & gt; (ParseTree.java:65) at nth.compling.ParseTreeTest.constructor (ParseTreeTest.java33) at sun.reflect. NativeMethodAccessorImpl.invoke0 (original method) at sun.reflect.NativeMethodAccessorImpl.invoke (unknown source) on the sun. Reflect.DelegatingMethodAccess orImpl.invoke on JavaklangkreflectkMethodkinvoke (Unknown Source) (Unknown Source) (OrgkjunitkinternalkrunnerskBeforeAndAfterRunnerkinvokeMethod on org.junit.internal.runners.BeforeAndAfterRunner BeforeAndAfterRunner.java: 74) .runBefores (BeforeAndAfterRunner.java:50) organization on org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33) on org.junit.internal.runners.TestClassRunner.run (TestClassRunner.java:52 ) On. On eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run org.eclipse.jdt.internal.junit.runner.TestExecution.run (TestExecution.java:38) (JUnit4TestReference.java:45) on org.eclipse.jdt. internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:460) on org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:673) on org.eclipse.jdt.internal.junit. Runner Remote testosterone (Remotster. Java 386) org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (Rem OteTestRunner.java.196)  

I comment: (and other references wsjLexParse)

  Private static lexicalized parser wsjLexParse = new LexicalizedParser (constant) .wsjLexFile);  

Then everything works fine. Am I doing wrong here?

Looks like a bug in the Stanford Library. You should report them to them.

When you only load it (and not the other), does another term work? Do you have the same error while loading two lexics in different order?


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -