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
public class DemoNShortSegment
{
public static void main(String[] args)
{
Segment nShortSegment = new NShortSegment().enableCustomDictionary(false).enablePlaceRecognize(true).enableOrganizationRecognize(true);
Segment shortestSegment = new ViterbiSegment().enableCustomDictionary(false).enablePlaceRecognize(true).enableOrganizationRecognize(true);
String[] testCase = new String[]{
"今天,刘志军案的关键人物,山西女商人丁书苗在市二中院出庭受审。",
"江西省监狱管理局与中国太平洋财产保险股份有限公司南昌中心支公司保险合同纠纷案",
"新北商贸有限公司",
};
for (String sentence : testCase)
{
System.out.println("N-最短分词:" + nShortSegment.seg(sentence) + "\n最短路分词:" + shortestSegment.seg(sentence));
}
}
}
期望输出
期望输出
实际输出
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 40
at com.hankcs.hanlp.seg.common.WordNet.get(WordNet.java:216)
at com.hankcs.hanlp.seg.common.WordNet.insert(WordNet.java:168)
at com.hankcs.hanlp.dictionary.nt.OrganizationDictionary$1.hit(OrganizationDictionary.java:3779)
at com.hankcs.hanlp.dictionary.nt.OrganizationDictionary$1.hit(OrganizationDictionary.java:3756)
at com.hankcs.hanlp.collection.AhoCorasick.AhoCorasickDoubleArrayTrie.parseText(AhoCorasickDoubleArrayTrie.java:115)
at com.hankcs.hanlp.dictionary.nt.OrganizationDictionary.parsePattern(OrganizationDictionary.java:3755)
at com.hankcs.hanlp.recognition.nt.OrganizationRecognition.recognition(OrganizationRecognition.java:71)
at com.hankcs.hanlp.seg.NShort.NShortSegment.segSentence(NShortSegment.java:79)
at com.hankcs.hanlp.seg.Segment.seg(Segment.java:557)
at com.hankcs.demo.DemoNShortSegment.main(DemoNShortSegment.java:36)
其他信息
The text was updated successfully, but these errors were encountered:
注意事项
请确认下列注意事项:
版本号
当前最新版本号是:portable-1.6.5
我使用的版本是:portable-1.6.5
我的问题
直接checkout工程,运行test/java/com/hankcs/demo/DemoNShortSegment时,报ArrayIndexOutOfBoundsException。
复现问题
步骤
触发代码
期望输出
实际输出
其他信息
The text was updated successfully, but these errors were encountered: