项目作者: guokr

项目描述 :
stan-cn-nlp:基于Stanford NLP软件包的API包装器,方便中国用户使用
高级语言: Java
项目地址: git://github.com/guokr/stan-cn-nlp.git
创建时间: 2012-11-28T07:10:12Z
项目社区:https://github.com/guokr/stan-cn-nlp

开源协议:Other

下载


stan-cn-nlp

An API wrapper based on Stanford NLP packages for the convenience of Chinese
users. This package is based on stan-cn-* family:

  • stan-cn-com: Common code base
  • stan-cn-seg: Chinese segmentation and related data model
  • stan-cn-ner: Named entity recognition and related data model
  • stan-cn-tag: POS tagging and related data model

This package bundled seg, ner and tagging together. So if you only need one of
them, you can use stan-cn-seg, stan-cn-ner, stan-cn-tag separately.

Purpose of the packages

The original Stanford CoreNLP packages with default language settings in Maven
central is only for English. If you are dealing with simplified Chinese, you
still need to download the Chinese model and fix some configuration files.

The burden is not too much, but if you deploy these packages to a server
cluster, this burden might be amplified.

Whatever you face a single node or a server farm, it would be a pleasurable
solution to provide packages with default settings of Chinese language
models. That is what we do.

Comments, reviews, bug reports and patches are welcomed.

Current version

Current version is 0.0.4 and based on Stanford CoreNLP 3.2.0 with minor fixes.

including below dependency:

  • maven:
    1. <dependency>
    2. <groupId>com.guokr</groupId>
    3. <artifactId>stan-cn-nlp</artifactId>
    4. <version>0.0.4</version>
    5. </dependency>
  • leiningen:
    1. [com.guokr/stan-cn-nlp "0.0.4"]
  • sbt:
    1. libraryDependencies += "com.guokr" % "stan-cn-nlp" % "0.0.4"

Simplified API

We use a very simple API to reduce the complexity.

  1. new SegWrapper(settings).segment(text);
  2. new NerWrapper(settings).recognize(text);
  3. new TagWrapper(settings).tag(text);

Or if you want to use the default language models, just use

  1. __PKG__.INSTANCE.segment(text);
  2. __PKG__.INSTANCE.recognize(text);
  3. __PKG__.INSTANCE.tag(text);

The command line tool

Please follow below steps to play with:

  • git clone git://github.com/guokr/stan-cn-nlp.git
  • cd stan-cn-nlp
  • mvn package
  • java -Xms1g -Xmx2g -jar target/stan-cn-nlp-0.0.5-SNAPSHOT-standalone.jar seg “大江东去浪淘尽”
  • java -Xms1g -Xmx2g -jar target/stan-cn-nlp-0.0.5-SNAPSHOT-standalone.jar ner “大江东去浪淘尽”
  • java -Xms1g -Xmx2g -jar target/stan-cn-nlp-0.0.5-SNAPSHOT-standalone.jar tag “大江东去浪淘尽”

Preparation for release

Before release this package to maven central, please execute below commands:

  • mvn clean source:jar javadoc:jar package
  • export MAVEN_OPTS=-Xmx2048m
  • mvn release:clean
  • mvn release:prepare
  • mvn release:perform

Authors

License

GPLv2, just same as the license of Stanford CoreNLP package