Skip to content

Commit d7ebfbe

Browse files
author
yaofei.sun
committed
check cross more
1 parent 5c325d5 commit d7ebfbe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/wltea/analyzer/core/LexemePath.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ Lexeme removeTail(){
122122
* @return
123123
*/
124124
boolean checkCross(Lexeme lexeme){
125-
return (lexeme.getBegin() >= this.pathBegin && lexeme.getBegin() < this.pathEnd)
126-
|| (this.pathBegin >= lexeme.getBegin() && this.pathBegin < lexeme.getBegin()+ lexeme.getLength());
125+
int start = this.getPathBegin() < lexeme.getBeginPosition() ? this.getPathBegin() : lexeme.getBegin();
126+
int end = this.getPathEnd() > lexeme.getEndPosition() ? this.getPathEnd() : lexeme.getEndPosition();
127+
128+
return (end - start) <= (this.getPathLength() + lexeme.getLength());
127129
}
128130

129131
int getPathBegin() {

0 commit comments

Comments
 (0)