use of com.graphaware.nlp.util.TestNLPGraph in project neo4j-nlp by graphaware.
the class Word2VecProcedureTest method testAttachVectorsToTagNodes.
@Test
public void testAttachVectorsToTagNodes() {
executeInTransaction("CALL ga.nlp.annotate({pipeline:'tokenizer', text: 'I met one agriculturist.', id: '123-fff', checkLanguage: false})", emptyConsumer());
TestNLPGraph tester = new TestNLPGraph(getDatabase());
tester.assertTagWithValueExist("agriculturist");
executeInTransaction("CALL ga.nlp.ml.word2vec.attach({query:\"MATCH (t:Tag) return t\", modelName:'numberbatch'}) YIELD result \n" + "return result;", (result -> {
assertTrue(result.hasNext());
}));
executeInTransaction("MATCH (n:Tag {value:'agriculturist'}) RETURN n", (result -> {
assertTrue(result.hasNext());
Map<String, Object> record = result.next();
assertTrue(((Node) record.get("n")).hasProperty("word2vec_type"));
assertTrue(((Node) record.get("n")).hasProperty("word2vec_array"));
}));
}
use of com.graphaware.nlp.util.TestNLPGraph in project neo4j-nlp by graphaware.
the class AnnotationPersistenceIntegrationTest method testLanguageIsDefaultedToENWhenCheckLanguageIsFalseAndLanguageCouldNotBeDetected.
@Test
public void testLanguageIsDefaultedToENWhenCheckLanguageIsFalseAndLanguageCouldNotBeDetected() {
try (Transaction tx = getDatabase().beginTx()) {
Node annotatedText = manager.annotateTextAndPersist("Barack Obama is born in Hawaii.", "123", pipelineSpecification);
tx.success();
}
TestNLPGraph test = new TestNLPGraph(getDatabase());
test.assertTagWithIdExist("Barack_en");
test.assertTagWithIdExist("born_en");
}
use of com.graphaware.nlp.util.TestNLPGraph in project neo4j-nlp by graphaware.
the class AnnotationPersistenceIntegrationTest method testAnnotationWillUseExistentFallbackLanguageIfCheckLanguageIsFalseAndNoLanguageIsDetected.
@Test
public void testAnnotationWillUseExistentFallbackLanguageIfCheckLanguageIsFalseAndNoLanguageIsDetected() {
manager.getConfiguration().updateInternalSetting(SettingsConstants.FALLBACK_LANGUAGE, "en");
try (Transaction tx = getDatabase().beginTx()) {
Node annotatedText = manager.annotateTextAndPersist("Barack Obama is born in Hawaii.", "123", pipelineSpecification);
tx.success();
}
TestNLPGraph test = new TestNLPGraph(getDatabase());
test.assertTagWithIdExist("Barack_en");
test.assertTagWithIdExist("born_en");
}
Aggregations