Skip to content

Commit

Permalink
CustomDictionary.insert("新词语", "词性标签") 支持省略频次
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Sep 28, 2018
1 parent d1dbf41 commit 1422c0f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/hankcs/hanlp/dictionary/CoreDictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ public static Attribute create(String natureWithFrequency)
try
{
String param[] = natureWithFrequency.split(" ");
if (param.length % 2 != 0)
{
return new Attribute(Nature.create(natureWithFrequency.trim()), 1); // 儿童锁
}
int natureCount = param.length / 2;
Attribute attribute = new Attribute(natureCount);
for (int i = 0; i < natureCount; ++i)
Expand Down

0 comments on commit 1422c0f

Please sign in to comment.