中文文本预处理的几个主要步骤有: 中文分词,词性标注,生成词向量,生成中文依存语法树。
Stanford NLP software是Stanford NLP小组提供的一个NLP处理工具集合,部分工具支持中文的处理。
该工具包是基于JAVA开发的。
1. 中文分词:
我下载的是stanford-segmenter-2015-12-09分词包。
解压缩后,直接运行内置到例子,如下所示:
sunfoot@sunfoot-ThinkPad-R61:~/Downloads/stanford-segmenter-2015-12-09$ ./segment.sh ctb test.simp.utf8 UTF-8 0
(CTB):
File: test.simp.utf8
Encoding: UTF-8
-------------------------------
CRFClassifier invoked on Tue Feb 23 20:22:26 CST 2016 with arguments:
-sighanCorporaDict ./data -textFile test.simp.utf8 -inputEncoding UTF-8 -sighanPostProcessing true -keepAllWhitespaces false -loadClassifier ./data/ctb.gz -serDictionary ./data/dict-chris6.ser.gz
serDictionary=./data/dict-chris6.ser.gz
loadClassifier=./data/ctb.gz
sighanCorporaDict=./data
inputEncoding=UTF-8
textFile=test.simp.utf8
sighanPostProcessing=true
keepAllWhitespaces=false
Loading classifier from .