From 621178ec7534483af79913817628dc3e93ec25d6 Mon Sep 17 00:00:00 2001 From: hankcs Date: Fri, 8 May 2015 14:55:48 +0800 Subject: [PATCH] fixed issue https://github.com/hankcs/HanLP/issues/11 --- .../java/com/hankcs/hanlp/summary/TextRankKeyword.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java b/src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java index 5a90c6595..90cb0ff5d 100644 --- a/src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java +++ b/src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java @@ -27,12 +27,6 @@ public class TextRankKeyword extends KeywordExtractor final static int max_iter = 200; final static float min_diff = 0.001f; - public TextRankKeyword() - { - // jdk bug : Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract! - System.setProperty("java.util.Arrays.useLegacyMergeSort", "true"); - } - /** * 提取关键词 * @param document 文档内容 @@ -117,7 +111,7 @@ public List getKeyword(String content) @Override public int compare(Map.Entry o1, Map.Entry o2) { - return (o1.getValue() - o2.getValue() > 0 ? -1 : 1); + return o2.getValue().compareTo(o1.getValue()); } }); // System.out.println(entryList);