/** @return {@link NormalizedWord2VecModel} created from a thrift representation */ public static NormalizedWord2VecModel fromThrift(final Word2VecModelThrift thrift) { return fromWord2VecModel(Word2VecModel.fromThrift(thrift)); }
/** @return {@link NormalizedWord2VecModel} created from a thrift representation */ public static NormalizedWord2VecModel fromThrift(final Word2VecModelThrift thrift) { return fromWord2VecModel(Word2VecModel.fromThrift(thrift)); }
.setVocab(vocab) .setVectors(vectors); return fromThrift(thrift);
.setVocab(vocab) .setVectors(vectors); return fromThrift(thrift);
/** Loads a model and allows user to find similar words */ public static void loadModel() throws IOException, TException, UnknownWordException { final Word2VecModel model; try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Loading model")) { String json = Common.readFileToString(new File("text8.model")); model = Word2VecModel.fromThrift(ThriftUtils.deserializeJson(new Word2VecModelThrift(), json)); } interact(model.forSearch()); }
/** Loads a model and allows user to find similar words */ public static void loadModel() throws IOException, TException, UnknownWordException { final Word2VecModel model; try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Loading model")) { String json = Common.readFileToString(new File("text8.model")); model = Word2VecModel.fromThrift(ThriftUtils.deserializeJson(new Word2VecModelThrift(), json)); } interact(model.forSearch()); }