Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get nearest neighbours using the API? #12

Open
gabrer opened this issue Jun 22, 2017 · 4 comments
Open

How to get nearest neighbours using the API? #12

gabrer opened this issue Jun 22, 2017 · 4 comments

Comments

@gabrer
Copy link

gabrer commented Jun 22, 2017

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".

@suresh-soundararajan
Copy link

Did you get any chance to implement this functionality ?

@plxCrush
Copy link

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
The commands supported by fasttext are:

Thanks in advance.

@aliakhtar
Copy link

Bump - can this please be added? Shouldn't be too hard as most other functions are supported and this is a pretty important one

@raman-r-4978
Copy link

Similar issue I have created in one of forked repo, hope it gives some idea.

carschno#9

If anyone interested, we can work on this to bring it as Java APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants