use of com.graphaware.nlp.event.EventDispatcher in project neo4j-nlp by graphaware.
the class NLPManager method init.
public void init(GraphDatabaseService database, DynamicConfiguration configuration) {
if (initialized) {
return;
}
this.configuration = configuration;
this.languageManager = new LanguageManager();
this.database = database;
this.persistenceRegistry = new PersistenceRegistry(database);
this.enrichmentRegistry = buildAndRegisterEnrichers();
this.eventDispatcher = new EventDispatcher();
loadExtensions();
if (textProcessorsManager == null) {
this.textProcessorsManager = new TextProcessorsManager(configuration);
}
this.textProcessorsManager.registerPipelinesFromConfig();
loadVectorComputationProcesses();
loadSummarizers();
registerWord2VecModelFromConfig();
initialized = true;
}
use of com.graphaware.nlp.event.EventDispatcher in project neo4j-nlp by graphaware.
the class NLPExtensionTest method testExtensionCanRegisterEventListeners.
@Test
public void testExtensionCanRegisterEventListeners() {
Map<String, NLPExtension> loadedExtensions = ServiceLoader.loadInstances(NLPModuleExtension.class);
EventDispatcher dispatcher = new EventDispatcher();
loadedExtensions.values().forEach(nlpExtension -> {
nlpExtension.registerEventListeners(dispatcher);
});
dispatcher.notify(StubEvents.HELLO, new DefaultEvent("hello you"));
NLPExtension nlpExtension = loadedExtensions.get(StubExtension.class.getName());
assertEquals("hello you", ((StubExtension) nlpExtension).getSomeValue());
}
use of com.graphaware.nlp.event.EventDispatcher in project neo4j-nlp by graphaware.
the class NLPManager method init.
public void init(GraphDatabaseService database, NLPConfiguration nlpConfiguration, DynamicConfiguration configuration) {
if (initialized) {
return;
}
this.nlpConfiguration = nlpConfiguration;
this.textProcessorsManager = new TextProcessorsManager();
this.configuration = configuration;
this.database = database;
this.persistenceRegistry = new PersistenceRegistry(database);
this.enrichmentRegistry = buildAndRegisterEnrichers();
this.eventDispatcher = new EventDispatcher();
this.vectorComputation = new QueryBasedVectorComputation(database);
loadExtensions();
registerEventListeners();
initialized = true;
registerPipelinesFromConfig();
}
Aggregations