|
@@ -51,32 +51,21 @@ public class ConceptSimilarity extends ConceptParser {
|
|
|
if (word1.equals(word2)) {
|
|
|
return 1.0;
|
|
|
}
|
|
|
- long start = System.currentTimeMillis();
|
|
|
Collection<Concept> concepts1 = getConcepts(word1);
|
|
|
- long time1 = System.currentTimeMillis();
|
|
|
- System.out.println("concepts1 cost : " + (time1 - start));
|
|
|
-
|
|
|
Collection<Concept> concepts2 = getConcepts(word2);
|
|
|
- long time2 = System.currentTimeMillis();
|
|
|
- System.out.println("concepts2 cost : " + (time2 - time1));
|
|
|
|
|
|
- long time3 = time2;
|
|
|
if (StringUtil.isBlank(concepts1) && StringUtil.isNotBlank(concepts2)) {
|
|
|
concepts1 = autoCombineConcepts(word1, concepts2);
|
|
|
- time3 = System.currentTimeMillis();
|
|
|
- System.out.println("autoCombineConcepts1 cost : " + (time3 - time2));
|
|
|
- } else if (StringUtil.isBlank(concepts2) && StringUtil.isNotBlank(concepts1)) {
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(concepts2) && StringUtil.isNotBlank(concepts1)) {
|
|
|
concepts2 = autoCombineConcepts(word2, concepts1);
|
|
|
- time3 = System.currentTimeMillis();
|
|
|
- System.out.println("autoCombineConcepts2 cost : " + (time3 - time2));
|
|
|
- } else if (StringUtil.isBlank(concepts1) && StringUtil.isBlank(concepts2)) {
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(concepts1) && StringUtil.isBlank(concepts2)) {
|
|
|
concepts1 = autoCombineConcepts(word1, concepts2);
|
|
|
concepts2 = autoCombineConcepts(word2, concepts1);
|
|
|
|
|
|
concepts1 = autoCombineConcepts(word1, concepts2);
|
|
|
concepts2 = autoCombineConcepts(word2, concepts1);
|
|
|
- time3 = System.currentTimeMillis();
|
|
|
- System.out.println("autoCombineConcepts3 cost : " + (time3 - time2));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -91,8 +80,6 @@ public class ConceptSimilarity extends ConceptParser {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- long time4 = System.currentTimeMillis();
|
|
|
- System.out.println("loop cost : " + (time4 - time3));
|
|
|
return similarity;
|
|
|
}
|
|
|
|
|
@@ -160,7 +147,7 @@ public class ConceptSimilarity extends ConceptParser {
|
|
|
}
|
|
|
|
|
|
if ((newConcepts.size() > MAX_COMBINED_COUNT)) {
|
|
|
- newConcepts.removeLast(newConcepts.size() / 3);
|
|
|
+ newConcepts.removeLast(MAX_COMBINED_COUNT / 3);
|
|
|
}
|
|
|
return newConcepts;
|
|
|
}
|