You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" java.lang.IllegalArgumentException: Illegal Capacity: -1
at java.util.ArrayList.(ArrayList.java:142)
at com.hankcs.hanlp.seg.HiddenMarkovModelSegment.convert(HiddenMarkovModelSegment.java:238)
at com.hankcs.hanlp.seg.Viterbi.ViterbiSegment.segSentence(ViterbiSegment.java:50)
at com.hankcs.hanlp.seg.Segment.seg(Segment.java:144)
at com.hankcs.hanlp.tokenizer.StandardTokenizer.segment(StandardTokenizer.java:39)
at com.hankcs.hanlp.HanLP.segment(HanLP.java:354)
原因是 com.hankcs.hanlp.seg.Viterbi.ViterbiSegment 中 47行
List vertexList = viterbi(wordNetAll);
返回结果
vertexList =[ ]
vertexList.size() = 1
但输入 "BENQBENTLEYphone"
则输出没报错,但结果不是想要的
人名角色观察:[ A 42634591 ][BENQ A 42634591 ][B L 3 ][ENTLEYphone A 42634591 ][ A 42634591 ]
人名角色标注:[ /A ,BENQ/A ,B/L ,ENTLEYphone/A , /A]
[BENQ/n, B/nx, ENTLEYphone/nx]
请问该如何修改才能添加英文词库呢?
The text was updated successfully, but these errors were encountered:
扩展词库加入英文,输入扩展英文连接另一英文,分词会报错。
原本以为是自定词性的问题,但将词性改为n,仍会报错
词库内容为
BENQ n 1024
BENTLEY n 1024
输入"BENQphone";
使用标准分词 HanLP.segment(text)
开启debug如下:
粗分词网:
0:[ ]
1:[BENQ]
2:[ENQphone]
3:[]
4:[]
5:[]
6:[]
7:[]
8:[]
9:[]
10:[ ]
会报出这样的错误
Exception in thread "main" java.lang.IllegalArgumentException: Illegal Capacity: -1
at java.util.ArrayList.(ArrayList.java:142)
at com.hankcs.hanlp.seg.HiddenMarkovModelSegment.convert(HiddenMarkovModelSegment.java:238)
at com.hankcs.hanlp.seg.Viterbi.ViterbiSegment.segSentence(ViterbiSegment.java:50)
at com.hankcs.hanlp.seg.Segment.seg(Segment.java:144)
at com.hankcs.hanlp.tokenizer.StandardTokenizer.segment(StandardTokenizer.java:39)
at com.hankcs.hanlp.HanLP.segment(HanLP.java:354)
原因是 com.hankcs.hanlp.seg.Viterbi.ViterbiSegment 中 47行
List vertexList = viterbi(wordNetAll);
返回结果
vertexList =[ ]
vertexList.size() = 1
但输入 "BENQBENTLEYphone"
则输出没报错,但结果不是想要的
人名角色观察:[ A 42634591 ][BENQ A 42634591 ][B L 3 ][ENTLEYphone A 42634591 ][ A 42634591 ]
人名角色标注:[ /A ,BENQ/A ,B/L ,ENTLEYphone/A , /A]
[BENQ/n, B/nx, ENTLEYphone/nx]
请问该如何修改才能添加英文词库呢?
The text was updated successfully, but these errors were encountered: