use of com.graphaware.nlp.stub.StubTextProcessor in project neo4j-nlp by graphaware.
the class AnnotationPersistenceIntegrationTest method testAnnotationRunWithPipelineDefaultFromUserConfig.
@Test
public void testAnnotationRunWithPipelineDefaultFromUserConfig() {
manager.getConfiguration().updateInternalSetting(SettingsConstants.DEFAULT_PIPELINE, TextProcessor.DEFAULT_PIPELINE);
try (Transaction tx = getDatabase().beginTx()) {
manager.annotateTextAndPersist("hello my name is John. I am working for IBM. I live in Italy", "123", pipelineSpecification);
tx.success();
}
try (Transaction tx = getDatabase().beginTx()) {
getDatabase().findNodes(Label.label("AnnotatedText")).stream().forEach(node -> {
manager.applySentiment(node, StubTextProcessor.class.getName());
});
tx.success();
}
TestNLPGraph tester = new TestNLPGraph(getDatabase());
tester.assertSentenceWithIdHasSentimentLabel("123_0", SentimentLabels.VeryPositive.toString());
assertEquals("tokenizer", ((StubTextProcessor) manager.getTextProcessorsManager().getTextProcessor("com.graphaware.nlp.stub.StubTextProcessor")).getLastPipelineUsed());
}
Aggregations