public void testLineCertaintyOrder() throws Exception {
for (int i = 0; i < 8; i++) {
repository.addArtifact(ai[i], null, artifactContent[i], artifactAuthor[i]);
}
repository.commit();
TokenIndex tokenIndex = repository.getTokenIndex();
List<Token> results = tokenIndex.listMostCertainTokens(artifactContent[6], 7);
// this test should print to the command line the following output:
// Results:
// p("IndexedTokenCore(-1,-1,Yay!)")=0.917004
// p("IndexedTokenCore(-1,-1,a)")=0.917004
// p("IndexedTokenCore(-1,-1,test)")=0.917004
// p("IndexedTokenCore(-1,-1,this)")=0.840896
// p("IndexedTokenCore(-1,-1,is)")=0.840896
// p("IndexedTokenCore(-1,-1,World)")=0.771105
// p("IndexedTokenCore(-1,-1,Hello)")=0.707107
System.out.println("Results: ");
for (Token token : results) {
System.out.println(String.format("p(\"%s\")=%f", token, tokenIndex.getCertainty(token)));
}
assertEquals(7, results.size());
Token token = results.get(5);
assertEquals(new IndexedTokenCore("World"), token);
token = results.get(6);