NLP4J ™

What is NLP4J?

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);
}
// -> output
// 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=.]

see StanfordPosAnnotatorExample0.java for detail.

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);
}
// -> output
// 学校 [facet=名詞, str=学校]
// に [facet=助詞, str=に]
// 行く [facet=動詞, str=行き]
// ます [facet=助動詞, str=まし]
// た [facet=助動詞, str=た]
// 。 [facet=記号, str=。]

see KuromojiAnnotatorExample0.java for detail.

Maven settings for English NLP

Please Wait... | Cloudflare
<!-- 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>

Maven settings for Japanese NLP

<!-- 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>

Recent Posts

Qiita Document (in Japanese)

NLP4J – Javaで自然言語処理 Index
https://qiita.com/oyahiroki/items/ba79a759c599d3459d29

Author 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/

TradeMarks

NLP4J is registered trademarks of Hiroki Oya in Japan.

Trademark Inquiry – j-platpat.input.go.jp

商標出願2021-117961 – j-platpat.inpit.go.jp