please i still have the same error you can help me ? -- [email protected] Inviato con Sparrow (http://www.sparrowmailapp.com/?sig)
Il giorno martedì 3 gennaio 2012, alle ore 04.30, James Kosin ha scritto: > On 1/2/2012 5:20 PM, [email protected] > (mailto:[email protected]) wrote: > > > > i have errors using openNLp you can tell me why ?? > > > > this is the code: > > > > InputStream modelIn = new FileInputStream(NLPModel/en-ner-person.bin"); > > ^^^ Here you are missing an opening quote character > > > > TokenNameFinderModel model = new TokenNameFinderModel(modelIn); > > > > modelIn.close(); > ^^^ You don't need to close the input stream. The > TokenNameFinderModel should be taking care of that. > > NameFinderME nameFinder = new NameFinderME(model); > > String[] split = input.split(" "); > > Span nameSpans[] = nameFinder.find(split); > > > > nameFinder.clearAdaptiveData(); > ^^^ This should be done before the nameFinder.find() call or not at all. > > > > if (nameSpans == null || nameSpans.length == 0) > > return; > > > > for (Span span : nameSpans) > > { > > StringBuilder buf = new StringBuilder(); > > > > for (int i = span.getStart(); i < span.getEnd(); i++) > > { > > buf.append(split[i]); > > if(i<span.getEnd()-1) > > > > ^^^ This if statement would probably be better with (i != > span.getEnd()) instead. > > buf.append(" "); > > > > } > > System.out.println(buf.toString()); > > } > > > > > > this is the error : > > > > > > > > (class: opennlp/model/GenericModelReader, method: checkModelType signature: > > ()V) Bad type in putfield/putstatic > > java.lang.VerifyError: (class: opennlp/model/GenericModelReader, method: > > checkModelType signature: ()V) Bad type in putfield/putstatic > > at > > opennlp.tools.util.model.GenericModelSerializer.create(GenericModelSerializer.java:35) > > at > > opennlp.tools.util.model.GenericModelSerializer.create(GenericModelSerializer.java:31) > > at opennlp.tools.util.model.BaseModel.<init>(BaseModel.java:135) > > at > > opennlp.tools.namefind.TokenNameFinderModel.<init>(TokenNameFinderModel.java:67) > > at LangProcessing.processingWithOpenNLP(LangProcessing.java:237) > > at OpenNLPJUnitTest.testHello(OpenNLPJUnitTest.java:33) > > > > What version of OpenNLP are you using and did the download of the model > succeed? > > Thanks, > James > >
