研究文本聚类,用的是ICTCLAS的分词系统。结果在处理文本的时候,会出现崩溃。
我起初以为是文本读取的问题,后来发现不是的。到Google上查找了一下"C [ICTCLAS.dll+0x9690]"这个错误,发现是ICTCLAS的Bug。
但问题是,我把文章独立读出来处理,就没有这样的问题,一放到我的工程中,程序就崩溃了。
做了很多的测试,都没有发现问题,真的是让人纠结。
我突然想到会不会是空格的问题呢?于是测试了这样一段代码:
- ICTCLAS ict = ICTCLAS.getInstance();
- String string=ict.paragraphProcess("\t");
- System.out.println(string);
当然,这也是没有问的。但是如果把代码变成这样呢?
- String content="\t";
- ICTCLAS ict = ICTCLAS.getInstance();
- String string=ict.paragraphProcess(content.trim());
- System.out.println(string);
在我的电脑上就会出现:
- An unexpected error has been detected by Java Runtime Environment:
- #
- # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x10009690, pid=2640, tid=3348
- #
- # Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode, sharing windows-x86)
- # Problematic frame:
- # C [ICTCLAS.dll+0x9690]
- #
- # An error report file with more information is saved as:
- # D:\workSpace\NameCluster_12\hs_err_pid2640.log
- #
- # If you would like to submit a bug report, please visit:
- # http://java.sun.com/webapps/bugreport/crash.jsp
- # The crash happened outside the Java Virtual Machine in native code.
- # See problematic frame for where to report the bug.
- #
也许还有其它的特殊字符会让程序崩溃。
比如:
String content="人名1/人名2/人名2/人名1";
ICTCLAS ict = ICTCLAS.getInstance(); String string=ict.paragraphProcess(content.trim()); System.out.println(string);