Search in sources :

Example 1 with TokenNameFinder

use of opennlp.tools.namefind.TokenNameFinder in project stanbol by apache.

the class OpenNLPTest method testLoadMissingNER.

@Test
public void testLoadMissingNER() throws IOException {
    //first unknown type
    TokenNameFinderModel model = openNLP.getNameModel("person2", "en");
    Assert.assertNull(model);
    TokenNameFinder ner = openNLP.getNameFinder("person2", "en");
    Assert.assertNull(ner);
    //unknown language
    model = openNLP.getNameModel("person", "ru");
    Assert.assertNull(model);
    ner = openNLP.getNameFinder("person", "ru");
    Assert.assertNull(ner);
}
Also used : TokenNameFinder(opennlp.tools.namefind.TokenNameFinder) TokenNameFinderModel(opennlp.tools.namefind.TokenNameFinderModel) Test(org.junit.Test)

Example 2 with TokenNameFinder

use of opennlp.tools.namefind.TokenNameFinder in project stanbol by apache.

the class OpenNLPTest method testLoadEnNER.

@Test
public void testLoadEnNER() throws IOException {
    for (String type : Arrays.asList("person", "organization", "location")) {
        TokenNameFinderModel model = openNLP.getNameModel(type, "en");
        Assert.assertNotNull(model);
        TokenNameFinder ner = openNLP.getNameFinder(type, "en");
        Assert.assertNotNull(ner);
    }
}
Also used : TokenNameFinder(opennlp.tools.namefind.TokenNameFinder) TokenNameFinderModel(opennlp.tools.namefind.TokenNameFinderModel) Test(org.junit.Test)

Aggregations

TokenNameFinder (opennlp.tools.namefind.TokenNameFinder)2 TokenNameFinderModel (opennlp.tools.namefind.TokenNameFinderModel)2 Test (org.junit.Test)2