CoreNLP README

The project's README from github.com/stanfordnlp/CoreNLP. As one markdown file: README.md.

Stanford CoreNLP

Run Tests Maven Central Twitter

Stanford CoreNLP provides a set of natural language analysis tools written in Java. It can take raw human language text input and give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize and interpret dates, times, and numeric quantities, mark up the structure of sentences in terms of syntactic phrases or dependencies, and indicate which noun phrases refer to the same entities. It was originally developed for English, but now also provides varying levels of support for (Modern Standard) Arabic, (mainland) Chinese, French, German, Hungarian, Italian, and Spanish. Stanford CoreNLP is an integrated framework, which makes it very easy to apply a bunch of language analysis tools to a piece of text. Starting from plain text, you can run all the tools with just two lines of code. Its analyses provide the foundational building blocks for higher-level and domain-specific text understanding applications. Stanford CoreNLP is a set of stable and well-tested natural language processing tools, widely used by various groups in academia, industry, and government. The tools variously use rule-based, probabilistic machine learning, and deep learning components.

The Stanford CoreNLP code is written in Java and licensed under the GNU General Public License (v2 or later). Note that this is the full GPL, which allows many free uses, but not its use in proprietary software that you distribute to others.

Build Instructions

Several times a year we distribute a new version of the software, which corresponds to a stable commit.

During the time between releases, one can always use the latest, under development version of our code.

Here are some helpful instructions to use the latest code:

Provided build

Sometimes we will provide updated jars here which have the latest version of the code.

At present, the current released version of the code is our most recent released jar, though you can always build the very latest from GitHub HEAD yourself.

Build with Ant

  1. Make sure you have Ant installed, details here: http://ant.apache.org/
  2. Compile the code with this command: cd CoreNLP ; ant
  3. Then run this command to build a jar with the latest version of the code: cd CoreNLP/classes ; jar -cf ../stanford-corenlp.jar edu
  4. This will create a new jar called stanford-corenlp.jar in the CoreNLP folder which contains the latest code
  5. The dependencies that work with the latest code are in CoreNLP/lib and CoreNLP/liblocal, so make sure to include those in your CLASSPATH.
  6. When using the latest version of the code make sure to download the latest versions of the corenlp-models, english-models, and english-models-kbp and include them in your CLASSPATH. If you are processing languages other than English, make sure to download the latest version of the models jar for the language you are interested in.

Build with Maven

  1. Make sure you have Maven installed, details here: https://maven.apache.org/
  2. If you run this command in the CoreNLP directory: mvn package , it should run the tests and build this jar file: CoreNLP/target/stanford-corenlp-4.5.4.jar
  3. When using the latest version of the code make sure to download the latest versions of the corenlp-models, english-extra-models, and english-kbp-models and include them in your CLASSPATH. If you are processing languages other than English, make sure to download the latest version of the models jar for the language you are interested in.
  4. If you want to use Stanford CoreNLP as part of a Maven project you need to install the models jars into your Maven repository. Below is a sample command for installing the Spanish models jar. For other languages just change the language name in the command. To install stanford-corenlp-models-current.jar you will need to set -Dclassifier=models. Here is the sample command for Spanish: mvn install:install-file -Dfile=/location/of/stanford-spanish-corenlp-models-current.jar -DgroupId=edu.stanford.nlp -DartifactId=stanford-corenlp -Dversion=4.5.4 -Dclassifier=models-spanish -Dpackaging=jar

Models

The models jars that correspond to the latest code can be found in the table below.

Some of the larger (English) models -- like the shift-reduce parser and WikiDict -- are not distributed with our default models jar. These require downloading the English (extra) and English (kbp) jars. Resources for other languages require usage of the corresponding models jar.

The best way to get the models is to use git-lfs and clone them from Hugging Face Hub.

For instance, to get the French models, run the following commands:

# Make sure you have git-lfs installed
# (https://git-lfs.github.com/)
git lfs install

git clone https://huggingface.co/stanfordnlp/corenlp-french

The jars can be directly downloaded from the links below or the Hugging Face Hub page as well.

Language Model Jar Last Updated
Arabic download (HF Hub) 4.5.6
Chinese download (HF Hub) 4.5.6
English (extra) download (HF Hub) 4.5.6
English (KBP) download (HF Hub) 4.5.6
French download (HF Hub) 4.5.6
German download (HF Hub) 4.5.6
Hungarian download (HF Hub) 4.5.6
Italian download (HF Hub) 4.5.6
Spanish download (HF Hub) 4.5.6

Thank you to Hugging Face for helping with our hosting!

Install by Gradle

If you don't know Gradle itself, see official site: https://gradle.org

Write the following in your build.gradle according to Maven Central:

dependencies {
    implementation 'edu.stanford.nlp:stanford-corenlp:4.5.5'
}

If you want to analyse English, add following:

    implementation "edu.stanford.nlp:stanford-corenlp:4.5.5:models"
    implementation "edu.stanford.nlp:stanford-corenlp:4.5.5:models-english"
    implementation "edu.stanford.nlp:stanford-corenlp:4.5.5:models-english-kbp"

If you use another version, replace "4.5.5" to a version you use.

Useful resources

You can find releases of Stanford CoreNLP on Maven Central.

You can find more explanation and documentation on the Stanford CoreNLP homepage.

For information about making contributions to Stanford CoreNLP, see the file CONTRIBUTING.md.

Questions about CoreNLP can either be posted on StackOverflow with the tag stanford-nlp, or on the mailing lists.

CoreNLP (stanfordnlp/CoreNLP)

Searching Database…

10.1K ·GitHub
这是什么东西?一套 Java 核心自然语言处理工具,接收原始的人类语言文本并返回语言学分析结果:分词、词性标注、命名实体识别、句法分析、指代消解和情感分析。
它是一个我在自己的 Java 代码里调用的库,还是一个需要单独运行的服务?是一个库:你把它作为依赖添加进来,然后在代码里调用。README 称它为一个集成框架——从纯文本出发,所有工具大约两行代码就能跑起来。
怎么把它加到我的项目里?从 Maven Central 取一个发行版作为你的 Gradle 或 Maven 依赖,或者用 'mvn package' 或 Ant 自己构建最新代码。模型 jar 包需要单独下载。
除了 Java 之外还需要安装别的东西吗?不需要——代码是纯 Java 的,不依赖 Python、GPU 或其他运行环境。你只需要把模型 jar 包放到 CLASSPATH 上;只有从源码构建时才需要 Ant 或 Maven。
第一次运行时人们容易在哪里卡住?模型并没有完全打包在一起:默认的 jar 只覆盖基础英语功能,而更大的模型(比如 shift-reduce 解析器和 WikiDict)需要英语 extra 包和 KBP 包,其他每种语言也都需要各自对应的模型 jar 包。
这是研究用的玩具,还是真的有生产系统在用它?是生产级别的:这些工具被描述为稳定且经过充分测试,被学术界、工业界和政府机构的众多团队广泛使用。
我能把它打包进我发行的专有产品里吗?不能——它采用完整的 GPL(v2 或更高版本)。大多数免费使用都没问题,但你不能把它作为专有软件的一部分进行分发。
对于一段文本,它究竟能告诉我什么?词的原形、词性、某个词是否是公司或人名、标准化后的日期、时间和数量、以句法短语或依存关系形式呈现的句子结构,以及哪些名词短语指的是同一个实体。
除了英语,它能处理其他语言吗?可以。它最初只支持英语,现在对现代标准阿拉伯语、简体中文、法语、德语、匈牙利语、意大利语和西班牙语提供不同程度的支持,每种语言都有各自的模型 jar 包,托管在 Hugging Face Hub 上。
它更新的频率如何?每年会发布几个新版本,都是从一个稳定的提交切出来的。在两次发布之间,你随时可以自己从 GitHub HEAD 构建最新的开发版代码。
它的底层是手写规则还是神经网络?两者都有:不同的工具分别使用了基于规则的、概率机器学习和深度学习的组件。
What are similar projects?HanLP, spaCy, bert, awesome-nlp, flair, NLP-progress, funNLP, allennlp
Size
395.1 MB
Stars
10.1K
Age
13y
Commits · 90 Days