Search in sources :

Example 1 with OpenNLP

use of org.apache.stanbol.commons.opennlp.OpenNLP in project stanbol by apache.

the class OpenNlpLabelTokenizerTest method init.

@BeforeClass
public static final void init() throws ConfigurationException {
    Dictionary<String, Object> config = new Hashtable<String, Object>();
    config.put(LabelTokenizer.SUPPORTED_LANUAGES, "*");
    ComponentContext cc = new MockComponentContext(config);
    tokenizer = new OpenNlpLabelTokenizer();
    tokenizer.openNlp = new OpenNLP(new ClasspathDataFileProvider(null));
    tokenizer.activate(cc);
}
Also used : ComponentContext(org.osgi.service.component.ComponentContext) OpenNLP(org.apache.stanbol.commons.opennlp.OpenNLP) Hashtable(java.util.Hashtable) BeforeClass(org.junit.BeforeClass)

Example 2 with OpenNLP

use of org.apache.stanbol.commons.opennlp.OpenNLP in project stanbol by apache.

the class TestNamedEntityExtractionEnhancementEngine method initDataFileProvicer.

@BeforeClass
public static void initDataFileProvicer() {
    DataFileProvider dataFileProvider = new ClasspathDataFileProvider(FAKE_BUNDLE_SYMBOLIC_NAME);
    openNLP = new OpenNLP(dataFileProvider);
}
Also used : OpenNLP(org.apache.stanbol.commons.opennlp.OpenNLP) DataFileProvider(org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileProvider) BeforeClass(org.junit.BeforeClass)

Example 3 with OpenNLP

use of org.apache.stanbol.commons.opennlp.OpenNLP in project stanbol by apache.

the class KeywordLinkingEngineTest method setUpServices.

@BeforeClass
public static void setUpServices() throws IOException {
    openNLP = new OpenNLP(new ClasspathDataFileProvider("DUMMY_SYMBOLIC_NAME"));
    searcher = new TestSearcherImpl(NAME, SimpleTokenizer.INSTANCE);
    //add some terms to the searcher
    Representation rep = factory.createRepresentation("urn:test:PatrickMarshall");
    rep.addNaturalText(NAME, "Patrick Marshall");
    rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PERSON.getUnicodeString());
    searcher.addEntity(rep);
    rep = factory.createRepresentation("urn:test:Geologist");
    rep.addNaturalText(NAME, "Geologist");
    rep.addReference(TYPE, NamespaceEnum.skos + "Concept");
    rep.addReference(REDIRECT, "urn:test:redirect:Geologist");
    searcher.addEntity(rep);
    //a redirect
    rep = factory.createRepresentation("urn:test:redirect:Geologist");
    rep.addNaturalText(NAME, "Geologe (redirect)");
    rep.addReference(TYPE, NamespaceEnum.skos + "Concept");
    searcher.addEntity(rep);
    rep = factory.createRepresentation("urn:test:NewZealand");
    rep.addNaturalText(NAME, "New Zealand");
    rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PLACE.getUnicodeString());
    searcher.addEntity(rep);
    rep = factory.createRepresentation("urn:test:UniversityOfOtago");
    rep.addNaturalText(NAME, "University of Otago");
    rep.addReference(TYPE, OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString());
    searcher.addEntity(rep);
    rep = factory.createRepresentation("urn:test:University");
    rep.addNaturalText(NAME, "University");
    rep.addReference(TYPE, NamespaceEnum.skos + "Concept");
    searcher.addEntity(rep);
    rep = factory.createRepresentation("urn:test:Otago");
    rep.addNaturalText(NAME, "Otago");
    rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PLACE.getUnicodeString());
    searcher.addEntity(rep);
    //add a 2nd Otago (Place and University
    rep = factory.createRepresentation("urn:test:Otago_Texas");
    rep.addNaturalText(NAME, "Otago (Texas)");
    rep.addNaturalText(NAME, "Otago");
    rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PLACE.getUnicodeString());
    searcher.addEntity(rep);
    rep = factory.createRepresentation("urn:test:UniversityOfOtago_Texas");
    rep.addNaturalText(NAME, "University of Otago (Texas)");
    rep.addReference(TYPE, OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString());
    searcher.addEntity(rep);
}
Also used : OpenNLP(org.apache.stanbol.commons.opennlp.OpenNLP) TestSearcherImpl(org.apache.stanbol.enhancer.engines.keywordextraction.impl.TestSearcherImpl) Representation(org.apache.stanbol.entityhub.servicesapi.model.Representation) ClasspathDataFileProvider(org.apache.stanbol.enhancer.engines.keywordextraction.impl.ClasspathDataFileProvider) BeforeClass(org.junit.BeforeClass)

Aggregations

OpenNLP (org.apache.stanbol.commons.opennlp.OpenNLP)3 BeforeClass (org.junit.BeforeClass)3 Hashtable (java.util.Hashtable)1 DataFileProvider (org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileProvider)1 ClasspathDataFileProvider (org.apache.stanbol.enhancer.engines.keywordextraction.impl.ClasspathDataFileProvider)1 TestSearcherImpl (org.apache.stanbol.enhancer.engines.keywordextraction.impl.TestSearcherImpl)1 Representation (org.apache.stanbol.entityhub.servicesapi.model.Representation)1 ComponentContext (org.osgi.service.component.ComponentContext)1