我正在使用 wordnet 来计算两个单词之间的相似度。我正在使用edu.mit.jwi_2.1.4.jar
,edu.sussex.nlp.jws.beta.11.jar
但是当我通过 resnik 测量计算“苹果”和“香蕉”这两个词时,它是 8,4。为什么大于1?
public class test {
String dir = "C:/Program Files (x86)/WordNet";
JWS ws = new JWS(dir,"2.1");
/**
* @param args
*/
public void testResnikSimilarity() {
Resnik jcn = ws.getResnik();
System.out.println("Resnik");
// all senses
TreeMap scores1 = jcn.res("apple", "banana", "n"); // all senses
//TreeMap scores1 = jcn.jcn("apple", 1, "banana", "n");
// fixed;all
//TreeMap scores1 = jcn.jcn("apple", "banana", 2, "n");
// all;fixed
for(String s : scores1.keySet())
System.out.println(s + "\t" + scores1.get(s));
// specific senses
System.out.println("\nspecific pair\t=\t" + jcn.res("apple", 1, "banana",
1, "n") + "\n");
// max.
System.out.println("\nhighest score\t=\t" + jcn.max("apple", "banana",
"n") + "\n\n\n");
}
}