Question

I am starting to learn the OpenNLP API by Jave. I found some good examples in this website

http://www.programcreek.com/2012/05/opennlp-tutorial/

I have tried the Name Finder API but I found something strange. If I replace the input as

String []sentence = new String[]{
            "John",
            "is",
            "good"
            };

The code is still working, but if I change it as

String []sentence = new String[]{
            "John",
            "is",
            "fine"
            };

There is no output.

I cannot understand what causes the problem. Is it form the model I use? (en-ner-person.bin) And does anyone know how can I build my own model?

Thanks!

Was it helpful?

Solution

Assuming it is not throwing an exception and just can't find the name "John," It's not working because the model cannot find John when the sentence is "John is fine" because OpenNLP is a Machine learning approach and it finds Named entities based on a model. The en-person.bin model apparently does not have sufficient samples of sentences similar enough to "john is fine" to return a probability high enough to give you a response.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top