use of com.graphaware.nlp.util.TestAnnotatedText in project neo4j-nlp-stanfordnlp by graphaware.
the class TextProcessorTest method testAnnotatedShortText.
@Test
public void testAnnotatedShortText() {
AnnotatedText annotatedText = textProcessor.annotateText("Fixing Batch Endpoint Logging Problem", "en", PIPELINE_DEFAULT);
assertEquals(1, annotatedText.getSentences().size());
TestAnnotatedText test = new TestAnnotatedText(annotatedText);
test.assertSentencesCount(1);
test.assertTagsCountInSentence(5, 0);
}
use of com.graphaware.nlp.util.TestAnnotatedText in project neo4j-nlp-stanfordnlp by graphaware.
the class TextProcessorTest method testLemmaLowerCasing.
@Test
public void testLemmaLowerCasing() {
String testText = "Collibra’s Data Governance Innovation: Enabling Data as a Strategic Asset";
AnnotatedText annotatedText = textProcessor.annotateText(testText, "en", PIPELINE_DEFAULT);
TestAnnotatedText test = new TestAnnotatedText(annotatedText);
test.assertSentencesCount(1);
assertEquals("governance", test.getTagAtPosition(0, 16).getLemma());
PipelineSpecification pipelineSpecification = new PipelineSpecification("tokenizeWithTrueCase", StanfordTextProcessor.class.getName());
pipelineSpecification.addProcessingStep("truecase");
textProcessor.createPipeline(pipelineSpecification);
annotatedText = textProcessor.annotateText(testText, "en", pipelineSpecification);
test = new TestAnnotatedText(annotatedText);
test.assertSentencesCount(1);
assertEquals("governance", test.getTagAtPosition(0, 16).getLemma());
assertEquals("Governance", test.getTagOccurrenceAtPosition(0, 16).getValue());
}
Aggregations