NLP4J

What is NLP4J?

NLP4J is a component of NLP4J Apps

NLP4J provides Data & Reports

NLP4J is a NLP Framework for Java

NLP4J is a Java Library for Natural Language Processing.
NLP4J provides NLP of English and Japanese Language, and framework for text-mining.

NLP4J Example for English NLP

Document doc = new DefaultDocument();
doc.putAttribute("text", "I eat sushi with chopsticks."); // English Text
StanfordPosAnnotator ann = new StanfordPosAnnotator(); // Annotator for English
ann.setProperty("target", "text"); // set target field
ann.annotate(doc); // Do annotation
for (Keyword kwd : doc.getKeywords()) { // List keywords
    System.err.println(kwd);
}

see StanfordPosAnnotatorExample0.java for detail.

Example Result of English NLP (Morphological analysis)

I [facet=word.PRP, str=I]
eat [facet=word.VBP, str=eat]
sushi [facet=word.NN, str=sushi]
with [facet=word.IN, str=with]
chopstick [facet=word.NNS, str=chopsticks]
. [facet=word.., str=.]

NLP4J Example for Japanese Language NLP (Morphological analysis) 日本語形態素解析

Document doc = new DefaultDocument();
doc.putAttribute("text", "私は学校に行きました。"); // Japanese text 日本語
KuromojiAnnotator annotator = new KuromojiAnnotator(); // Annotator for Japanese Language
annotator.setProperty("target", "text"); // Set target field
annotator.annotate(doc); // Do annotation
for (Keyword kwd : doc.getKeywords()) { // List Keywords
	System.err.println(kwd);
}

see KuromojiAnnotatorExample0.java for detail.

Example Result of Japanese NLP 日本語

私 [facet=名詞, str=私]
は [facet=助詞, str=は]
学校 [facet=名詞, str=学校]
に [facet=助詞, str=に]
行く [facet=動詞, str=行き]
ます [facet=助動詞, str=まし]
た [facet=助動詞, str=た]
。 [facet=記号, str=。]

Maven settings for NLP4J

<!-- https://mvnrepository.com/artifact/org.nlp4j/nlp4j-stanford -->
<dependency>
    <groupId>org.nlp4j</groupId>
    <artifactId>nlp4j-core</artifactId>
    <version>[1.3.1.0,)</version>
</dependency>
<!-- For English -->
<dependency>
    <groupId>org.nlp4j</groupId>
    <artifactId>nlp4j-stanford</artifactId>
    <version>[1.3.0.0,)</version>
</dependency>
<!-- For English -->
<!-- https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp -->
<dependency>
    <groupId>edu.stanford.nlp</groupId>
    <artifactId>stanford-corenlp</artifactId>
    <version>4.0.0</version>
    <scope>provided</scope>
</dependency>
<!-- For English -->
<!-- https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp -->
<dependency>
    <groupId>edu.stanford.nlp</groupId>
    <artifactId>stanford-corenlp</artifactId>
    <version>4.0.0</version>
    <classifier>models</classifier>
    <scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.nlp4j/nlp4j-stanford -->
<dependency>
    <groupId>org.nlp4j</groupId>
    <artifactId>nlp4j-core</artifactId>
    <version>[1.3.1.0,)</version>
</dependency>
<!-- For Japanese 日本語 -->
<!-- https://mvnrepository.com/artifact/com.atilika.kuromoji/kuromoji -->
<dependency>
	<groupId>com.atilika.kuromoji</groupId>
	<artifactId>kuromoji</artifactId>
	<version>0.9.0</version>
	<type>pom</type>
</dependency>

Related Links of NLP4J

NLP4J Apps
GitHub - oyahiroki/nlp4j: Natural Language Processing library for Java
Natural Language Processing library for Java. Contribute to oyahiroki/nlp4j development by creating an account on GitHub.
Please Wait... | Cloudflare
NLP4J - Javaで自然言語処理 - Qiita
NLP4J はテキストマイニングや自然言語処理に必要な以下の機能を提供するJavaライブラリです。 データ収集機能 (クローラー Crawler) 自然言語処理呼び出し機能 (アノテーター Annotator) 形態素解析 構...

Recent Posts

Contact

Hiroki Oya 大矢裕己
2001-2018 IBM Japan Software Lab.
2018- Nissan Motor Co Ltd. Connected Car Service Dev
2021- IBM Japan Software Lab
https://twitter.com/oyahiroki
https://www.linkedin.com/in/oyahiroki/