RaduADumitru / codex

Web API for migration of DEXonline into a graph database
MIT License
2 stars 2 forks source link

No controller for knn (k-nearest neighbour) #1

Closed bocse closed 2 years ago

bocse commented 2 years ago

What is the endpoint I can call to compute k-nearest neighbours between a given string (”anaaremere”) and the words in the dictionarym, while also specifying the distance (Euclid, Hann, Hamming, Manhattan, Levenshtein) ?

Results should be ordered descending by distance (nearest elements first, farthest elements last) and it should also have some parameter for setting a LIMIT (cut-off) (eg. show only first 100 matches)

I looked here https://github.com/bocse/codex/blob/main/codex/src/main/java/org/example/codex/controller/LexemeController.java

Please advise :)

RaduADumitru commented 2 years ago

I added the following endpoints for KNN searches: /codex/knn/editdistance to search by Levenshtein, Hamming or LCS distance, and codex/knn/ngram to search by n-gram similarity or n-gram positional similarity. Implementation details can be found in https://github.com/RaduADumitru/codex/blob/main/codex/src/main/java/org/example/codex/controller/KnnController.java