huaban / jieba-analysis

结巴分词(java版)
https://github.com/huaban/jieba-analysis
Apache License 2.0
2.57k stars 837 forks source link

字典与分词不一致 #90

Open catBigcat opened 5 years ago

catBigcat commented 5 years ago

WordDictionary加载字典有如下代码(150行左右), private String addWord(String word) {
if (null != word && !"".equals(word.trim())) { String key = word.trim().toLowerCase(Locale.getDefault()); _dict.fillSegment(key.toCharArray()); return key; } else return null; } 这里的问题是word.trim().toLowerCase(Locale.getDefault())。 而进行切分时,并没有对字符串做相关处理,导致bug。