diff --git a/src/main/java/org/wltea/analyzer/core/LexemePath.java b/src/main/java/org/wltea/analyzer/core/LexemePath.java index 91a6c288..5b9cef96 100644 --- a/src/main/java/org/wltea/analyzer/core/LexemePath.java +++ b/src/main/java/org/wltea/analyzer/core/LexemePath.java @@ -122,8 +122,10 @@ Lexeme removeTail(){ * @return */ boolean checkCross(Lexeme lexeme){ - return (lexeme.getBegin() >= this.pathBegin && lexeme.getBegin() < this.pathEnd) - || (this.pathBegin >= lexeme.getBegin() && this.pathBegin < lexeme.getBegin()+ lexeme.getLength()); + int start = this.getPathBegin() < lexeme.getBeginPosition() ? this.getPathBegin() : lexeme.getBegin(); + int end = this.getPathEnd() > lexeme.getEndPosition() ? this.getPathEnd() : lexeme.getEndPosition(); + + return (end - start) <= (this.getPathLength() + lexeme.getLength()); } int getPathBegin() {