sszuev / fastText_java

Java port of c++ version of facebook fasttext
Other
14 stars 5 forks source link

Added method to retrieve k nearest neighbours from given query vector #7

Closed sebastianarnold closed 5 years ago

sebastianarnold commented 5 years ago

In some cases it is practical to retrieve k nearest neighbours not only for a given word: nn(int k, String queryWord) but also for a given vector: nn(int k, Vector queryVec)

I implemented this function so we can use it in our application, maybe this is helpful to others. Feel free to merge it.

PS: fasttext 0.2.0 was re-licensed to MIT (https://github.com/facebookresearch/fastText/commit/7842495a4d64c7a3bb4339d45d6e64321d002ed8), maybe you can reflect this in your library as well.

sszuev commented 5 years ago

Hello Thank you for PR!

Although, a good PR must be accompanied with tests, this one seems to be safe. Anyway, even in the main codebase there is a lack of tests.

About licensing. This fasttext_java fork reflects only 0.1.0 cpp version, so I am not sure something needs to be changed in that sense. When (if) the main codebase will be updated to 0.2.0, the license will be changed as well.

About maven build. I think I can create pre-release with a tag 1.0.1-SNAPSHOT, and your patch will be available through JitPack.