Search in sources :

Example 1 with DataFileResourceLoader

use of org.apache.stanbol.commons.solr.utils.DataFileResourceLoader in project stanbol by apache.

the class TestKuromojiNlpEngine method setUpServices.

@Before
public void setUpServices() throws IOException, ConfigurationException {
    engine = new KuromojiNlpEngine();
    //we need to set some fields that would otherwise be injected by the container
    engine.parentResourceLoader = new DataFileResourceLoader(dataFileProvider);
    engine.analysedTextFactory = AnalysedTextFactory.getDefaultInstance();
    Dictionary<String, Object> config = new Hashtable<String, Object>();
    config.put(EnhancementEngine.PROPERTY_NAME, "gosen-nlp");
    engine.activate(new MockComponentContext(config));
    contentItem = contentItemFactory.createContentItem(id, new StringSource(text));
    //add an annotation that this is Japanese
    contentItem.getMetadata().add(new TripleImpl(id, Properties.DC_LANGUAGE, new PlainLiteralImpl("ja")));
}
Also used : PlainLiteralImpl(org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl) Hashtable(java.util.Hashtable) StringSource(org.apache.stanbol.enhancer.servicesapi.impl.StringSource) TripleImpl(org.apache.clerezza.commons.rdf.impl.utils.TripleImpl) DataFileResourceLoader(org.apache.stanbol.commons.solr.utils.DataFileResourceLoader) Before(org.junit.Before)

Aggregations

Hashtable (java.util.Hashtable)1 PlainLiteralImpl (org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl)1 TripleImpl (org.apache.clerezza.commons.rdf.impl.utils.TripleImpl)1 DataFileResourceLoader (org.apache.stanbol.commons.solr.utils.DataFileResourceLoader)1 StringSource (org.apache.stanbol.enhancer.servicesapi.impl.StringSource)1 Before (org.junit.Before)1