JFastText
JFastText copied to clipboard
How to get nearest neighbours using the API?
Hi!
I want to get the nearest neighbours inside my Java code using the JFastText API; however, I can not find which method I should use. In the original library the method is the "void FastText::nn(int32_t k)", but so far I've been able to call it only by JFastText "command".
Did you get any chance to implement this functionality ?
How can you use nn command for specific word? i'm trying something like:
`public void printSimilars(String x) {
jft.runCmd(new String[] {
String.format("echo %s |", x),
"nn",
MODEL_BIN,
});
}`
to get 10 similar words for a given word in model.
I get this error: "usage: fasttext
Thanks in advance.
Bump - can this please be added? Shouldn't be too hard as most other functions are supported and this is a pretty important one
Similar issue I have created in one of forked repo, hope it gives some idea.
https://github.com/carschno/JFastText/issues/9
If anyone interested, we can work on this to bring it as Java APIs.