Search in sources :

Example 1 with Word2VecIndexLookup

use of com.graphaware.nlp.ml.word2vec.Word2VecIndexLookup in project neo4j-nlp by graphaware.

the class Word2VecProcedure method listModels.

@Procedure(name = "ga.nlp.ml.word2vec.listModels", mode = Mode.WRITE)
public Stream<Word2VecModelResult> listModels() {
    Word2VecProcessor word2VecProcessor = (Word2VecProcessor) getNLPManager().getExtension(Word2VecProcessor.class);
    Map<String, Word2VecIndexLookup> models = word2VecProcessor.getWord2VecModel().getModels();
    List<Word2VecModelResult> results = new ArrayList<>();
    models.keySet().forEach(s -> {
        try {
            results.add(new Word2VecModelResult(s, models.get(s).getStorePath(), models.get(s).countIndex()));
        } catch (IOException e) {
        // 
        }
    });
    return results.stream();
}
Also used : ArrayList(java.util.ArrayList) Word2VecModelResult(com.graphaware.nlp.dsl.result.Word2VecModelResult) IOException(java.io.IOException) Word2VecIndexLookup(com.graphaware.nlp.ml.word2vec.Word2VecIndexLookup) Word2VecProcessor(com.graphaware.nlp.ml.word2vec.Word2VecProcessor)

Aggregations

Word2VecModelResult (com.graphaware.nlp.dsl.result.Word2VecModelResult)1 Word2VecIndexLookup (com.graphaware.nlp.ml.word2vec.Word2VecIndexLookup)1 Word2VecProcessor (com.graphaware.nlp.ml.word2vec.Word2VecProcessor)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1