Skip to content

Commit

Permalink
修复自定义词性 fix #1172
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed May 6, 2019
1 parent e33b1e5 commit 69cddf7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/hankcs/hanlp/seg/Segment.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ private static void combineWords(Vertex[] wordNet, int start, int end, CoreDicti
sbTerm.append(realWord);
wordNet[j] = null;
}
wordNet[start] = new Vertex(sbTerm.toString(), value);
String realWord = sbTerm.toString();
wordNet[start] = new Vertex(realWord, realWord, value);
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/test/java/com/hankcs/hanlp/seg/SegmentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -530,4 +530,10 @@ public void testIssue932() throws Exception
HanLP.Config.enableDebug();
System.out.println(segment.seg("福哈生态工程有限公司"));
}

public void testIssue1172()
{
CustomDictionary.insert("我的额度", "xyz");
System.out.println(HanLP.segment("我的额度不够,需要提高额度"));
}
}

0 comments on commit 69cddf7

Please sign in to comment.