Search in sources :

Example 1 with NERModelTool

use of com.graphaware.nlp.processor.stanford.model.NERModelTool in project neo4j-nlp-stanfordnlp by graphaware.

the class StanfordTextProcessor method test.

@Override
public String test(String alg, String modelId, String file, String lang) {
    LOG.info("Testing of " + alg + " with id " + modelId + " started.");
    NERModelTool nerModel = new NERModelTool(modelId, lang);
    String testFilePath = FileUtils.resolveFilePath(getModelsWorkdir(), file);
    return nerModel.test(testFilePath, getModelLocation(modelId));
}
Also used : NERModelTool(com.graphaware.nlp.processor.stanford.model.NERModelTool)

Example 2 with NERModelTool

use of com.graphaware.nlp.processor.stanford.model.NERModelTool in project neo4j-nlp-stanfordnlp by graphaware.

the class StanfordTextProcessor method train.

@Override
public String train(String alg, String modelId, String file, String lang, Map<String, Object> params) {
    LOG.info("Training of " + alg + " with id " + modelId + " started.");
    String propFile = null;
    if (params != null && params.containsKey("propertiesFile"))
        propFile = (String) params.get("propertiesFile");
    LOG.info("Initialising ...");
    String modelDir = getModelsWorkdir();
    String trainFilePath = FileUtils.resolveFilePath(modelDir, file);
    String modelPath = FileUtils.resolveFilePath(modelDir, createModelFileName(alg, modelId));
    NERModelTool nerModel = new NERModelTool(trainFilePath, modelId, lang, propFile);
    nerModel.train(modelPath);
    storeModelLocation(modelId, modelPath);
    return "Training successful.";
}
Also used : NERModelTool(com.graphaware.nlp.processor.stanford.model.NERModelTool)

Aggregations

NERModelTool (com.graphaware.nlp.processor.stanford.model.NERModelTool)2