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