mayabot/fastText4j

nnSearch and analogies does not return the specified k

Closed this issue · 1 comments

Loaded the model for english if I set k=5 return less

   private static FastText model;

    @BeforeClass
    public static void onlyOnce() throws Exception {
        String modelPath = "../cc.en.300.bin";
        model = FastText.loadFasttextBinModel(modelPath);
    }

    @Test
    public void nnSearch() {
        int topN = 5;
        List<FloatStringPair> predict = model.nearestNeighbor("king", topN);
        assertEquals(topN, predict.size());
    }

    @Test
    public void analogies() {
        int topN = 5;
        List<FloatStringPair> predict = model.analogies("berlin", "germany", "france", topN);
        assertEquals(topN, predict.size());
    }
java.lang.AssertionError: 
Expected :5
Actual   :3

java.lang.AssertionError: 
Expected :5
Actual   :4
<dependency>
  <groupId>com.mayabot.mynlp</groupId>
  <artifactId>fastText4j</artifactId>
  <version>3.1.0</version>
</dependency>