From d7ebfbe7f9705395bee0208cdcd9804da8afd4ed Mon Sep 17 00:00:00 2001 From: "yaofei.sun" Date: Tue, 12 Jan 2016 18:49:41 +0800 Subject: [PATCH] check cross more --- src/main/java/org/wltea/analyzer/core/LexemePath.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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() {