I goofed on the if () change for the test.  If you look carefully there
is a trailing space in your output....  Shoot.

James

On 1/3/2012 8:04 PM, [email protected] wrote:
> work properly thank you very much
>
> --  
> [email protected]
> Inviato con Sparrow (http://www.sparrowmailapp.com/?sig)
>
>
> Il giorno mercoledì 4 gennaio 2012, alle ore 01.56, James Kosin ha scritto:  
>
>> You need to include the maxcent-3.0.0.jar file to your project as well.
>>  
>> James
>>  
>> On 1/3/2012 7:31 AM, [email protected] 
>> (mailto:[email protected]) wrote:
>>> i have still the same error  
>>>  
>>> Im using open-nlp-tools1.50.jar and 1.5 models  
>>>  
>>> InputStream modelIn = new FileInputStream("en-ner-person.bin");
>>>  
>>> TokenNameFinderModel model = new TokenNameFinderModel(modelIn);
>>>  
>>> NameFinderME nameFinder = new NameFinderME(model);
>>> String[] split = input.split(" ");
>>> Span nameSpans[] = nameFinder.find(split);
>>>  
>>> 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())
>>> buf.append(" ");
>>>  
>>> }
>>> System.out.println(buf.toString());
>>> }
>>>  
>>>  
>>>  
>>> you can link me to the models maybe i wrong the page i suppose is this:
>>> http://opennlp.sourceforge.net/models-1.5/
>>> and version this:
>>> http://sourceforge.net/projects/opennlp/
>>>  
>>> 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: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)
>>>  
>>>  
>>>  
>>> --  
>>> [email protected] (mailto:[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
>>>>  
>>>>  
>>>>  
>>>  
>>>  
>>  
>>  
>>  
>
>

Reply via email to