stanford-segmenter中文分词基本使用

首先进入http://nlp.stanford.edu/software/segmenter.shtml#Download 下载stanford-segmenter-2016-10-31.zip,解压之后,进入目录中,查看README-Chinese.txt文件。

命令行操作

进入到解压后的文件目录中,输入下面代码

./segment.sh pku test.simp.utf8 UTF-8 0

可以看到如下结果
Stanford segmenter结果

eclipse中操作

新建一个java工程,将下载的压缩包解压后的arabic,data文件夹,文件test.simp.utf8,复制到java的工程下,并且java工程引用这三个jar文件:stanford-segmenter-3.7.0.jar、stanford-segmenter-3.7.0-javadoc.jar、stanford-segmenter-3.7.0-sources.jar。注意,eclipse中的java版本要求是1.8版本之上的。将解压之后的SegDemo.java文件,复制到工程之中。操作完成之后,eclipse是类似下面这张图片左边的样子。

eclipse中进行Stanford segmenter

j为SegDemo.java的运行添加参数“test.simp.utf8”,在工程目录上,右键Run As -> Run Configurations,在program arguments下面写上“test.simp.utf8”即可。
这里写图片描述
运行结果如第一张图片所示。

假设因为工程运行所需内存较大,而系统为java提供的内存不满足其要求,那么做以下操作即可
在当前页面Run As -> Run Configurations,在VM arguments中写入参数,由于Stanford-Sementer占用的内存比较大,所以需要设置VM arguments,不然就会超内存。在VM arguments:下面填写“-Xms512m -Xmx1024m”。[参考网页1]
假设出现编码错误,那么请设置工程的编码为utf-8。建议:最好对eclipse的默认编码设置为utf-8格式。

备注

  1. 在文章中使用时候,注意添加以下参考Pi-Chuan Chang, Michel Galley and Chris Manning. 2008. Optimizing Chinese Word Segmentation for Machine Translation Performance. In WMT.
  2. http://nlp.stanford.edu/pubs/sighan2005.pdf 这是1中的文章
  3. 此工具,还实现了对阿拉伯语的分词。并且为其他编程语言提供了Stanford Word Segmenter的package,如python,F#/C#/.NET,都可以在http://nlp.stanford.edu/software/segmenter.shtml 这个页面上查看相关说明以及下载使用。

参考网页
1. http://www.cfanz.cn/index.php?c=article&a=read&id=272910
2. http://blog.csdn.net/shijiebei2009/article/details/42525091
这个网页对NER与分词都作了介绍,而且作为一个整体一起使用。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Tokenization of raw text is a standard pre-processing step for many NLP tasks. For English, tokenization usually involves punctuation splitting and separation of some affixes like possessives. Other languages require more extensive token pre-processing, which is usually called segmentation. The Stanford Word Segmenter currently supports Arabic and Chinese. The provided segmentation schemes have been found to work well for a variety of applications. The system requires Java 1.6+ to be installed. We recommend at least 1G of memory for documents that contain long sentences. For files with shorter sentences (e.g., 20 tokens), decrease the memory requirement by changing the option java -mx1g in the run scripts. Arabic Arabic is a root-and-template language with abundant bound morphemes. These morphemes include possessives, pronouns, and discourse connectives. Segmenting bound morphemes reduces lexical sparsity and simplifies syntactic analysis. The Arabic segmenter model processes raw text according to the Penn Arabic Treebank 3 (ATB) standard. It is a stand-alone implementation of the segmenter described in: Spence Green and John DeNero. 2012. A Class-Based Agreement Model for Generating Accurately Inflected Translations. In ACL. Chinese Chinese is standardly written without spaces between words (as are some other languages). This software will split Chinese text into a sequence of words, defined according to some word segmentation standard. It is a Java implementation of the CRF-based Chinese Word Segmenter described in: Huihsin Tseng, Pichuan Chang, Galen Andrew, Daniel Jurafsky and Christopher Manning. 2005. A Conditional Random Field Word Segmenter. In Fourth SIGHAN Workshop on Chinese Language Processing. Two models with two different segmentation standards are included: Chinese Penn Treebank standard and Peking University standard. On May 21, 2008, we released a version that makes use of lexicon features. With external lexicon features, the segmenter segmen
### 回答1: Stanford CoreNLP是一个开源的自然语言处理工具包,提供了一系列的NLP工具和库,用于文本分析、信息提取、语义标注、句法分析等任务。而stanford-corenlp-full-2015-12-09则是这个工具包的一个特定版本。 stanford-corenlp-full-2015-12-09包含了所有Stanford CoreNLP工具和库的完整集合。它包括了多种NLP模型,用于处理不同的语言和任务。这个版本发布于2015年12月09日,并且提供了丰富的功能和性能优化。它支持英语、中文等多种语言的文本处理,并且可以用于词性标注、命名实体识别、关系抽取、情感分析、依存句法分析等多种任务。 使用stanford-corenlp-full-2015-12-09,我们可以通过简单的调用API接口来使用各种NLP功能。它可以处理单个文本、文本集合甚至是大规模的文本数据。我们可以提取文本的关键信息,如实体识别、情感分析和关键词提取等。此外,它还提供了丰富的语言处理技术,如分词、词性标注、命名实体识别和依存句法分析,可以帮助研究人员和开发者进行更深入的文本分析和语义理解。 总而言之,stanford-corenlp-full-2015-12-09是一个功能强大且广泛使用的NLP工具包,提供了多种NLP任务的解决方案。它可以帮助使用者快速准确地分析文本,提取有用的信息,并为后续的文本处理和语义分析任务提供基础支持。 ### 回答2: Stanford CoreNLP是斯坦福大学开发的一款自然语言处理工具包,其完整版2015-12-09是指CoreNLP的一个特定版本,发布于2015年12月9号。Stanford CoreNLP提供了一系列强大的功能,包括分词、词性标注、命名实体识别、句法分析、依存关系分析等。这些功能能够帮助用户对文本进行深入的语言理解和分析。 Stanford CoreNLP使用Java编写,可以通过命令行或API接口进行使用。它支持多种语言,包括英语、中文、阿拉伯语等。用户可以通过简单的调用相应的功能模块,实现对文本的处理和分析。 在中文处理方面,Stanford CoreNLP通过使用中文分词器以及中文词性标注器,能够将中文文本进行分词和词性标注。此外,它还能够进行中文的命名实体识别,例如识别人名、地名、时间等实体。同时,Stanford CoreNLP还提供了句法分析和依存关系分析功能,可以帮助用户理解句子的结构和句法关系。 总之,Stanford CoreNLP完整版2015-12-09是一款功能强大的自然语言处理工具,能够帮助用户对文本进行深入的语言分析和理解。它具有广泛的应用领域,包括信息提取、机器翻译、文本分类等。用户可以使用它来处理中文文本,并通过其提供的多种功能模块对文本进行处理和分析。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值