diff --git a/src/main/java/org/wltea/analyzer/core/CJKSegmenter.java b/src/main/java/org/wltea/analyzer/core/CJKSegmenter.java index 83818d0..3689a97 100644 --- a/src/main/java/org/wltea/analyzer/core/CJKSegmenter.java +++ b/src/main/java/org/wltea/analyzer/core/CJKSegmenter.java @@ -80,17 +80,16 @@ class CJKSegmenter implements ISegmenter { // ********************************* // 再对当前指针位置的字符进行单字匹配 Hit singleCharHit = Dictionary.getSingleton().matchInMainDict(context.getSegmentBuff(), context.getCursor(), 1); - if (singleCharHit.isMatch()) {// 首字成词 + + // 首字为词前缀 + if (singleCharHit.isMatch()) { // 输出当前的词 Lexeme newLexeme = new Lexeme(context.getBufferOffset(), context.getCursor(), 1, Lexeme.TYPE_CNWORD); context.addLexeme(newLexeme); + } - // 同时也是词前缀 - if (singleCharHit.isPrefix()) { - // 前缀匹配则放入hit列表 - this.tmpHits.add(singleCharHit); - } - } else if (singleCharHit.isPrefix()) {// 首字为词前缀 + // 前缀匹配则放入hit列表 + if (singleCharHit.isPrefix()) { // 前缀匹配则放入hit列表 this.tmpHits.add(singleCharHit); }