carschno / JFastText

Java interface for fastText
Other
16 stars 12 forks source link

Nearest Neighbor search on Word Embeddings #9

Open raman-r-4978 opened 4 years ago

raman-r-4978 commented 4 years ago

Hi,

Just wanted to know that Is it possible to execute this ./fasttext nn model.bin command, via JAVA call?

reference

carschno commented 4 years ago

Yes, nn should work, although it is not really tested. Have you tried it?

raman-r-4978 commented 4 years ago

Thanks for the reply

Yes it is possible, when I execute

jft.runCmd(
    new String[]{
        "nn",
            "model.bin"
    }
);

By default nn takes input from stdin. Check here

Is there any way to bring this functionality into Java. Something like this,

jft.loadModel("model.bin");
List<NearestNeighbors> nn = jft.getNearestNeighbors("sampleWord", 10);

Hope you get me now. Thanks

carschno commented 4 years ago

I'm afraid this feature is not implemented indeed. You mentioned you had a fork implementing; feel free to create a pull request from it!

raman-r-4978 commented 4 years ago

I have no experience with bindings and JNI. Could you give some tips on this? That would be helpful for me to develop this feature.

Thanks