NLP4J [006-030] NLP4J で言語処理100本ノック #30 形態素解析結果の読み込み


[Indexに戻る](https://qiita.com/oyahiroki/items/ba79a759c599d3459d29) 

やってみます。

# 30. 形態素解析結果の読み込み
> 形態素解析結果（neko.txt.mecab）を読み込むプログラムを実装せよ．

# Maven

現在開発中のバージョンを利用します。

```xml
<dependency>
	<groupId>org.nlp4j</groupId>
	<artifactId>nlp4j-core</artifactId>
	<version>1.1.1.0-SNAPSHOT</version>
</dependency>
```

# Text Data

デフォルトで利用している形態素解析（Yahoo! Japan デベロッパーネットワーク 日本語形態素解析) では、リクエストサイズの上限が900KBであり、回数に制限もあるので小さなサイズのテキストファイルを利用しています。

```
一

　吾輩は猫である。
名前はまだ無い。

　どこで生れたかとんと見当がつかぬ。
何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。
吾輩はここで始めて人間というものを見た。
しかもあとで聞くとそれは書生という人間中で一番獰悪な種族であったそうだ。
この書生というのは時々我々を捕えて煮て食うという話である。
しかしその当時は何という考もなかったから別段恐しいとも思わなかった。
ただ彼の掌に載せられてスーと持ち上げられた時何だかフワフワした感じがあったばかりである。
掌の上で少し落ちついて書生の顔を見たのがいわゆる人間というものの見始であろう。
この時妙なものだと思った感じが今でも残っている。
第一毛をもって装飾されべきはずの顔がつるつるしてまるで薬缶だ。
その後猫にもだいぶ逢ったがこんな片輪には一度も出会わした事がない。
のみならず顔の真中があまりに突起している。
そうしてその穴の中から時々ぷうぷうと煙を吹く。
どうも咽せぽくて実に弱った。
これが人間の飲む煙草というものである事はようやくこの頃知った。


```


# Java Code

```java
package nlp4j.nokku.chap4;
import java.util.List;
import nlp4j.Document;
import nlp4j.DocumentAnnotator;
import nlp4j.DocumentAnnotatorPipeline;
import nlp4j.Keyword;
import nlp4j.crawler.Crawler;
import nlp4j.crawler.TextFileLineSeparatedCrawler;
import nlp4j.impl.DefaultDocumentAnnotatorPipeline;
import nlp4j.yhoo_jp.YJpMaAnnotator;

public class Nokku30 {
	public static void main(String[] args) throws Exception {
		// NLP4Jが提供するテキストファイルのクローラーを利用する
		Crawler crawler = new TextFileLineSeparatedCrawler();
		crawler.setProperty("file", "src/test/resources/nlp4j.crawler/neko_short_utf8.txt");
		crawler.setProperty("encoding", "UTF-8");
		crawler.setProperty("target", "text");

		// ドキュメントのクロール
		List<Document> docs = crawler.crawlDocuments();

		// NLPパイプライン（複数の処理をパイプラインとして連結することで処理する）の定義
		DocumentAnnotatorPipeline pipeline = new DefaultDocumentAnnotatorPipeline();
		{
			// Yahoo! Japan の形態素解析APIを利用するアノテーター
			DocumentAnnotator annotator = new YJpMaAnnotator();
			pipeline.add(annotator);
		}
		// アノテーション処理の実行
		pipeline.annotate(docs);
		for (Document doc : docs) {
			// 本文
			System.err.println(doc.getText());
			for (Keyword kwd : doc.getKeywords()) {
				System.err.println(" - " + kwd.toString());
			}
		}
	}
}

```

# 結果

```
一
 - 1 [sequence=1, facet=名詞, lex=1, str=一, reading=1, count=-1, begin=0, end=1, correlation=0.0]

　吾輩は猫である。
 - 　 [sequence=1, facet=特殊, lex=　, str=　, reading=　, count=-1, begin=0, end=1, correlation=0.0]
 - 吾輩は猫である [sequence=2, facet=名詞, lex=吾輩は猫である, str=吾輩は猫である, reading=わがはいはねこである, count=-1, begin=1, end=8, correlation=0.0]
 - 。 [sequence=3, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=8, end=9, correlation=0.0]
名前はまだ無い。
 - 名前 [sequence=1, facet=名詞, lex=名前, str=名前, reading=なまえ, count=-1, begin=0, end=2, correlation=0.0]
 - は [sequence=2, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=2, end=3, correlation=0.0]
 - まだ [sequence=3, facet=副詞, lex=まだ, str=まだ, reading=まだ, count=-1, begin=3, end=5, correlation=0.0]
 - 無い [sequence=4, facet=形容詞, lex=無い, str=無い, reading=ない, count=-1, begin=5, end=7, correlation=0.0]
 - 。 [sequence=5, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=7, end=8, correlation=0.0]

　どこで生れたかとんと見当がつかぬ。
 - 　 [sequence=1, facet=特殊, lex=　, str=　, reading=　, count=-1, begin=0, end=1, correlation=0.0]
 - どこ [sequence=2, facet=名詞, lex=どこ, str=どこ, reading=どこ, count=-1, begin=1, end=3, correlation=0.0]
 - で [sequence=3, facet=助詞, lex=で, str=で, reading=で, count=-1, begin=3, end=4, correlation=0.0]
 - 生れる [sequence=4, facet=動詞, lex=生れる, str=生れ, reading=うまれ, count=-1, begin=4, end=6, correlation=0.0]
 - た [sequence=5, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=6, end=7, correlation=0.0]
 - か [sequence=6, facet=助詞, lex=か, str=か, reading=か, count=-1, begin=7, end=8, correlation=0.0]
 - とんと [sequence=7, facet=副詞, lex=とんと, str=とんと, reading=とんと, count=-1, begin=8, end=11, correlation=0.0]
 - 見当 [sequence=8, facet=名詞, lex=見当, str=見当, reading=けんとう, count=-1, begin=11, end=13, correlation=0.0]
 - が [sequence=9, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=13, end=14, correlation=0.0]
 - つく [sequence=10, facet=動詞, lex=つく, str=つか, reading=つか, count=-1, begin=14, end=16, correlation=0.0]
 - ぬ [sequence=11, facet=助動詞, lex=ぬ, str=ぬ, reading=ぬ, count=-1, begin=16, end=17, correlation=0.0]
 - 。 [sequence=12, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=17, end=18, correlation=0.0]
何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。
 - 何でも [sequence=1, facet=副詞, lex=何でも, str=何でも, reading=なんでも, count=-1, begin=0, end=3, correlation=0.0]
 - 薄暗い [sequence=2, facet=形容詞, lex=薄暗い, str=薄暗い, reading=うすぐらい, count=-1, begin=3, end=6, correlation=0.0]
 - じめじめ [sequence=3, facet=副詞, lex=じめじめ, str=じめじめ, reading=じめじめ, count=-1, begin=6, end=10, correlation=0.0]
 - する [sequence=4, facet=動詞, lex=する, str=し, reading=し, count=-1, begin=10, end=11, correlation=0.0]
 - た [sequence=5, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=11, end=12, correlation=0.0]
 - 所 [sequence=6, facet=名詞, lex=所, str=所, reading=ところ, count=-1, begin=12, end=13, correlation=0.0]
 - で [sequence=7, facet=助詞, lex=で, str=で, reading=で, count=-1, begin=13, end=14, correlation=0.0]
 - ニャーニャー [sequence=8, facet=副詞, lex=ニャーニャー, str=ニャーニャー, reading=にゃーにゃー, count=-1, begin=14, end=20, correlation=0.0]
 - 泣く [sequence=9, facet=動詞, lex=泣く, str=泣い, reading=ない, count=-1, begin=20, end=22, correlation=0.0]
 - て [sequence=10, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=22, end=23, correlation=0.0]
 - いる [sequence=11, facet=助動詞, lex=いる, str=い, reading=い, count=-1, begin=23, end=24, correlation=0.0]
 - た [sequence=12, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=24, end=25, correlation=0.0]
 - 事 [sequence=13, facet=名詞, lex=事, str=事, reading=こと, count=-1, begin=25, end=26, correlation=0.0]
 - だけ [sequence=14, facet=助詞, lex=だけ, str=だけ, reading=だけ, count=-1, begin=26, end=28, correlation=0.0]
 - は [sequence=15, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=28, end=29, correlation=0.0]
 - 記憶 [sequence=16, facet=名詞, lex=記憶, str=記憶, reading=きおく, count=-1, begin=29, end=31, correlation=0.0]
 - する [sequence=17, facet=助動詞, lex=する, str=し, reading=し, count=-1, begin=31, end=32, correlation=0.0]
 - て [sequence=18, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=32, end=33, correlation=0.0]
 - いる [sequence=19, facet=助動詞, lex=いる, str=いる, reading=いる, count=-1, begin=33, end=35, correlation=0.0]
 - 。 [sequence=20, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=35, end=36, correlation=0.0]
吾輩はここで始めて人間というものを見た。
 - 吾輩 [sequence=1, facet=名詞, lex=吾輩, str=吾輩, reading=わがはい, count=-1, begin=0, end=2, correlation=0.0]
 - は [sequence=2, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=2, end=3, correlation=0.0]
 - ここ [sequence=3, facet=名詞, lex=ここ, str=ここ, reading=ここ, count=-1, begin=3, end=5, correlation=0.0]
 - で [sequence=4, facet=助詞, lex=で, str=で, reading=で, count=-1, begin=5, end=6, correlation=0.0]
 - 始める [sequence=5, facet=動詞, lex=始める, str=始め, reading=はじめ, count=-1, begin=6, end=8, correlation=0.0]
 - て [sequence=6, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=8, end=9, correlation=0.0]
 - 人間 [sequence=7, facet=名詞, lex=人間, str=人間, reading=にんげん, count=-1, begin=9, end=11, correlation=0.0]
 - と [sequence=8, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=11, end=12, correlation=0.0]
 - いう [sequence=9, facet=動詞, lex=いう, str=いう, reading=いう, count=-1, begin=12, end=14, correlation=0.0]
 - もの [sequence=10, facet=名詞, lex=もの, str=もの, reading=もの, count=-1, begin=14, end=16, correlation=0.0]
 - を [sequence=11, facet=助詞, lex=を, str=を, reading=を, count=-1, begin=16, end=17, correlation=0.0]
 - 見る [sequence=12, facet=動詞, lex=見る, str=見, reading=み, count=-1, begin=17, end=18, correlation=0.0]
 - た [sequence=13, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=18, end=19, correlation=0.0]
 - 。 [sequence=14, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=19, end=20, correlation=0.0]
しかもあとで聞くとそれは書生という人間中で一番獰悪な種族であったそうだ。
 - しかも [sequence=1, facet=接続詞, lex=しかも, str=しかも, reading=しかも, count=-1, begin=0, end=3, correlation=0.0]
 - あと [sequence=2, facet=名詞, lex=あと, str=あと, reading=あと, count=-1, begin=3, end=5, correlation=0.0]
 - で [sequence=3, facet=助詞, lex=で, str=で, reading=で, count=-1, begin=5, end=6, correlation=0.0]
 - 聞く [sequence=4, facet=動詞, lex=聞く, str=聞く, reading=きく, count=-1, begin=6, end=8, correlation=0.0]
 - と [sequence=5, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=8, end=9, correlation=0.0]
 - それ [sequence=6, facet=名詞, lex=それ, str=それ, reading=それ, count=-1, begin=9, end=11, correlation=0.0]
 - は [sequence=7, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=11, end=12, correlation=0.0]
 - 書生 [sequence=8, facet=名詞, lex=書生, str=書生, reading=しょせい, count=-1, begin=12, end=14, correlation=0.0]
 - と [sequence=9, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=14, end=15, correlation=0.0]
 - いう [sequence=10, facet=動詞, lex=いう, str=いう, reading=いう, count=-1, begin=15, end=17, correlation=0.0]
 - 人間 [sequence=11, facet=名詞, lex=人間, str=人間, reading=にんげん, count=-1, begin=17, end=19, correlation=0.0]
 - 中 [sequence=12, facet=接尾辞, lex=中, str=中, reading=ちゅう, count=-1, begin=19, end=20, correlation=0.0]
 - で [sequence=13, facet=助詞, lex=で, str=で, reading=で, count=-1, begin=20, end=21, correlation=0.0]
 - 一番 [sequence=14, facet=副詞, lex=一番, str=一番, reading=いちばん, count=-1, begin=21, end=23, correlation=0.0]
 - 獰悪 [sequence=15, facet=名詞, lex=獰悪, str=獰悪, reading=どうあく, count=-1, begin=23, end=25, correlation=0.0]
 - だ [sequence=16, facet=助動詞, lex=だ, str=な, reading=な, count=-1, begin=25, end=26, correlation=0.0]
 - 種族 [sequence=17, facet=名詞, lex=種族, str=種族, reading=しゅぞく, count=-1, begin=26, end=28, correlation=0.0]
 - だ [sequence=18, facet=助動詞, lex=だ, str=で, reading=で, count=-1, begin=28, end=29, correlation=0.0]
 - ある [sequence=19, facet=助動詞, lex=ある, str=あっ, reading=あっ, count=-1, begin=29, end=31, correlation=0.0]
 - た [sequence=20, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=31, end=32, correlation=0.0]
 - そう [sequence=21, facet=助詞, lex=そう, str=そう, reading=そう, count=-1, begin=32, end=34, correlation=0.0]
 - だ [sequence=22, facet=助動詞, lex=だ, str=だ, reading=だ, count=-1, begin=34, end=35, correlation=0.0]
 - 。 [sequence=23, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=35, end=36, correlation=0.0]
この書生というのは時々我々を捕えて煮て食うという話である。
 - この [sequence=1, facet=連体詞, lex=この, str=この, reading=この, count=-1, begin=0, end=2, correlation=0.0]
 - 書生 [sequence=2, facet=名詞, lex=書生, str=書生, reading=しょせい, count=-1, begin=2, end=4, correlation=0.0]
 - と [sequence=3, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=4, end=5, correlation=0.0]
 - いう [sequence=4, facet=動詞, lex=いう, str=いう, reading=いう, count=-1, begin=5, end=7, correlation=0.0]
 - の [sequence=5, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=7, end=8, correlation=0.0]
 - は [sequence=6, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=8, end=9, correlation=0.0]
 - 時々 [sequence=7, facet=名詞, lex=時々, str=時々, reading=ときどき, count=-1, begin=9, end=11, correlation=0.0]
 - 我々 [sequence=8, facet=名詞, lex=我々, str=我々, reading=われわれ, count=-1, begin=11, end=13, correlation=0.0]
 - を [sequence=9, facet=助詞, lex=を, str=を, reading=を, count=-1, begin=13, end=14, correlation=0.0]
 - 捕える [sequence=10, facet=動詞, lex=捕える, str=捕え, reading=とらえ, count=-1, begin=14, end=16, correlation=0.0]
 - て [sequence=11, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=16, end=17, correlation=0.0]
 - 煮る [sequence=12, facet=動詞, lex=煮る, str=煮, reading=に, count=-1, begin=17, end=18, correlation=0.0]
 - て [sequence=13, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=18, end=19, correlation=0.0]
 - 食う [sequence=14, facet=動詞, lex=食う, str=食う, reading=くう, count=-1, begin=19, end=21, correlation=0.0]
 - と [sequence=15, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=21, end=22, correlation=0.0]
 - いう [sequence=16, facet=動詞, lex=いう, str=いう, reading=いう, count=-1, begin=22, end=24, correlation=0.0]
 - 話 [sequence=17, facet=名詞, lex=話, str=話, reading=はなし, count=-1, begin=24, end=25, correlation=0.0]
 - だ [sequence=18, facet=助動詞, lex=だ, str=で, reading=で, count=-1, begin=25, end=26, correlation=0.0]
 - ある [sequence=19, facet=助動詞, lex=ある, str=ある, reading=ある, count=-1, begin=26, end=28, correlation=0.0]
 - 。 [sequence=20, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=28, end=29, correlation=0.0]
しかしその当時は何という考もなかったから別段恐しいとも思わなかった。
 - しかし [sequence=1, facet=接続詞, lex=しかし, str=しかし, reading=しかし, count=-1, begin=0, end=3, correlation=0.0]
 - その [sequence=2, facet=連体詞, lex=その, str=その, reading=その, count=-1, begin=3, end=5, correlation=0.0]
 - 当時 [sequence=3, facet=名詞, lex=当時, str=当時, reading=とうじ, count=-1, begin=5, end=7, correlation=0.0]
 - は [sequence=4, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=7, end=8, correlation=0.0]
 - 何という [sequence=5, facet=連体詞, lex=何という, str=何という, reading=なんという, count=-1, begin=8, end=12, correlation=0.0]
 - 考 [sequence=6, facet=名詞, lex=考, str=考, reading=かんがえ, count=-1, begin=12, end=13, correlation=0.0]
 - も [sequence=7, facet=助詞, lex=も, str=も, reading=も, count=-1, begin=13, end=14, correlation=0.0]
 - ない [sequence=8, facet=形容詞, lex=ない, str=なかっ, reading=なかっ, count=-1, begin=14, end=17, correlation=0.0]
 - た [sequence=9, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=17, end=18, correlation=0.0]
 - から [sequence=10, facet=助詞, lex=から, str=から, reading=から, count=-1, begin=18, end=20, correlation=0.0]
 - 別段 [sequence=11, facet=副詞, lex=別段, str=別段, reading=べつだん, count=-1, begin=20, end=22, correlation=0.0]
 - 恐い [sequence=12, facet=形容詞, lex=恐い, str=恐し, reading=こわし, count=-1, begin=22, end=24, correlation=0.0]
 - いとも [sequence=13, facet=副詞, lex=いとも, str=いとも, reading=いとも, count=-1, begin=24, end=27, correlation=0.0]
 - 思う [sequence=14, facet=動詞, lex=思う, str=思わ, reading=おもわ, count=-1, begin=27, end=29, correlation=0.0]
 - ない [sequence=15, facet=助動詞, lex=ない, str=なかっ, reading=なかっ, count=-1, begin=29, end=32, correlation=0.0]
 - た [sequence=16, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=32, end=33, correlation=0.0]
 - 。 [sequence=17, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=33, end=34, correlation=0.0]
ただ彼の掌に載せられてスーと持ち上げられた時何だかフワフワした感じがあったばかりである。
 - ただ [sequence=1, facet=接続詞, lex=ただ, str=ただ, reading=ただ, count=-1, begin=0, end=2, correlation=0.0]
 - 彼 [sequence=2, facet=名詞, lex=彼, str=彼, reading=かれ, count=-1, begin=2, end=3, correlation=0.0]
 - の [sequence=3, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=3, end=4, correlation=0.0]
 - 掌 [sequence=4, facet=名詞, lex=掌, str=掌, reading=てのひら, count=-1, begin=4, end=5, correlation=0.0]
 - に [sequence=5, facet=助詞, lex=に, str=に, reading=に, count=-1, begin=5, end=6, correlation=0.0]
 - 載せる [sequence=6, facet=動詞, lex=載せる, str=載せ, reading=のせ, count=-1, begin=6, end=8, correlation=0.0]
 - られる [sequence=7, facet=助動詞, lex=られる, str=られ, reading=られ, count=-1, begin=8, end=10, correlation=0.0]
 - て [sequence=8, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=10, end=11, correlation=0.0]
 - スー [sequence=9, facet=名詞, lex=スー, str=スー, reading=すー, count=-1, begin=11, end=13, correlation=0.0]
 - と [sequence=10, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=13, end=14, correlation=0.0]
 - 持ち上げる [sequence=11, facet=動詞, lex=持ち上げる, str=持ち上げ, reading=もちあげ, count=-1, begin=14, end=18, correlation=0.0]
 - られる [sequence=12, facet=助動詞, lex=られる, str=られ, reading=られ, count=-1, begin=18, end=20, correlation=0.0]
 - た [sequence=13, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=20, end=21, correlation=0.0]
 - 時 [sequence=14, facet=名詞, lex=時, str=時, reading=とき, count=-1, begin=21, end=22, correlation=0.0]
 - 何だか [sequence=15, facet=副詞, lex=何だか, str=何だか, reading=なんだか, count=-1, begin=22, end=25, correlation=0.0]
 - フワフワ [sequence=16, facet=副詞, lex=フワフワ, str=フワフワ, reading=ふわふわ, count=-1, begin=25, end=29, correlation=0.0]
 - する [sequence=17, facet=動詞, lex=する, str=し, reading=し, count=-1, begin=29, end=30, correlation=0.0]
 - た [sequence=18, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=30, end=31, correlation=0.0]
 - 感じ [sequence=19, facet=名詞, lex=感じ, str=感じ, reading=かんじ, count=-1, begin=31, end=33, correlation=0.0]
 - が [sequence=20, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=33, end=34, correlation=0.0]
 - ある [sequence=21, facet=動詞, lex=ある, str=あっ, reading=あっ, count=-1, begin=34, end=36, correlation=0.0]
 - た [sequence=22, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=36, end=37, correlation=0.0]
 - ばかり [sequence=23, facet=助詞, lex=ばかり, str=ばかり, reading=ばかり, count=-1, begin=37, end=40, correlation=0.0]
 - だ [sequence=24, facet=助動詞, lex=だ, str=で, reading=で, count=-1, begin=40, end=41, correlation=0.0]
 - ある [sequence=25, facet=助動詞, lex=ある, str=ある, reading=ある, count=-1, begin=41, end=43, correlation=0.0]
 - 。 [sequence=26, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=43, end=44, correlation=0.0]
掌の上で少し落ちついて書生の顔を見たのがいわゆる人間というものの見始であろう。
 - 掌 [sequence=1, facet=名詞, lex=掌, str=掌, reading=てのひら, count=-1, begin=0, end=1, correlation=0.0]
 - の [sequence=2, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=1, end=2, correlation=0.0]
 - 上 [sequence=3, facet=名詞, lex=上, str=上, reading=うえ, count=-1, begin=2, end=3, correlation=0.0]
 - で [sequence=4, facet=助詞, lex=で, str=で, reading=で, count=-1, begin=3, end=4, correlation=0.0]
 - 少し [sequence=5, facet=名詞, lex=少し, str=少し, reading=すこし, count=-1, begin=4, end=6, correlation=0.0]
 - 落ちつく [sequence=6, facet=動詞, lex=落ちつく, str=落ちつい, reading=おちつい, count=-1, begin=6, end=10, correlation=0.0]
 - て [sequence=7, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=10, end=11, correlation=0.0]
 - 書生 [sequence=8, facet=名詞, lex=書生, str=書生, reading=しょせい, count=-1, begin=11, end=13, correlation=0.0]
 - の [sequence=9, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=13, end=14, correlation=0.0]
 - 顔 [sequence=10, facet=名詞, lex=顔, str=顔, reading=かお, count=-1, begin=14, end=15, correlation=0.0]
 - を [sequence=11, facet=助詞, lex=を, str=を, reading=を, count=-1, begin=15, end=16, correlation=0.0]
 - 見る [sequence=12, facet=動詞, lex=見る, str=見, reading=み, count=-1, begin=16, end=17, correlation=0.0]
 - た [sequence=13, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=17, end=18, correlation=0.0]
 - の [sequence=14, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=18, end=19, correlation=0.0]
 - が [sequence=15, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=19, end=20, correlation=0.0]
 - いわゆる [sequence=16, facet=連体詞, lex=いわゆる, str=いわゆる, reading=いわゆる, count=-1, begin=20, end=24, correlation=0.0]
 - 人間 [sequence=17, facet=名詞, lex=人間, str=人間, reading=にんげん, count=-1, begin=24, end=26, correlation=0.0]
 - と [sequence=18, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=26, end=27, correlation=0.0]
 - いう [sequence=19, facet=動詞, lex=いう, str=いう, reading=いう, count=-1, begin=27, end=29, correlation=0.0]
 - ものの [sequence=20, facet=助詞, lex=ものの, str=ものの, reading=ものの, count=-1, begin=29, end=32, correlation=0.0]
 - 見始 [sequence=21, facet=名詞, lex=見始, str=見始, reading=みはじめ, count=-1, begin=32, end=34, correlation=0.0]
 - だ [sequence=22, facet=助動詞, lex=だ, str=で, reading=で, count=-1, begin=34, end=35, correlation=0.0]
 - ある [sequence=23, facet=助動詞, lex=ある, str=あろ, reading=あろ, count=-1, begin=35, end=37, correlation=0.0]
 - う [sequence=24, facet=助動詞, lex=う, str=う, reading=う, count=-1, begin=37, end=38, correlation=0.0]
 - 。 [sequence=25, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=38, end=39, correlation=0.0]
この時妙なものだと思った感じが今でも残っている。
 - この [sequence=1, facet=連体詞, lex=この, str=この, reading=この, count=-1, begin=0, end=2, correlation=0.0]
 - 時 [sequence=2, facet=名詞, lex=時, str=時, reading=とき, count=-1, begin=2, end=3, correlation=0.0]
 - 妙 [sequence=3, facet=名詞, lex=妙, str=妙, reading=みょう, count=-1, begin=3, end=4, correlation=0.0]
 - だ [sequence=4, facet=助動詞, lex=だ, str=な, reading=な, count=-1, begin=4, end=5, correlation=0.0]
 - もの [sequence=5, facet=名詞, lex=もの, str=もの, reading=もの, count=-1, begin=5, end=7, correlation=0.0]
 - だ [sequence=6, facet=助動詞, lex=だ, str=だ, reading=だ, count=-1, begin=7, end=8, correlation=0.0]
 - と [sequence=7, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=8, end=9, correlation=0.0]
 - 思う [sequence=8, facet=動詞, lex=思う, str=思っ, reading=おもっ, count=-1, begin=9, end=11, correlation=0.0]
 - た [sequence=9, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=11, end=12, correlation=0.0]
 - 感じ [sequence=10, facet=名詞, lex=感じ, str=感じ, reading=かんじ, count=-1, begin=12, end=14, correlation=0.0]
 - が [sequence=11, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=14, end=15, correlation=0.0]
 - 今 [sequence=12, facet=名詞, lex=今, str=今, reading=いま, count=-1, begin=15, end=16, correlation=0.0]
 - でも [sequence=13, facet=助詞, lex=でも, str=でも, reading=でも, count=-1, begin=16, end=18, correlation=0.0]
 - 残る [sequence=14, facet=動詞, lex=残る, str=残っ, reading=のこっ, count=-1, begin=18, end=20, correlation=0.0]
 - て [sequence=15, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=20, end=21, correlation=0.0]
 - いる [sequence=16, facet=助動詞, lex=いる, str=いる, reading=いる, count=-1, begin=21, end=23, correlation=0.0]
 - 。 [sequence=17, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=23, end=24, correlation=0.0]
第一毛をもって装飾されべきはずの顔がつるつるしてまるで薬缶だ。
 - 第 [sequence=1, facet=接頭辞, lex=第, str=第, reading=だい, count=-1, begin=0, end=1, correlation=0.0]
 - 1 [sequence=2, facet=名詞, lex=1, str=一, reading=1, count=-1, begin=1, end=2, correlation=0.0]
 - 毛 [sequence=3, facet=接尾辞, lex=毛, str=毛, reading=もう, count=-1, begin=2, end=3, correlation=0.0]
 - を [sequence=4, facet=助詞, lex=を, str=を, reading=を, count=-1, begin=3, end=4, correlation=0.0]
 - もつ [sequence=5, facet=動詞, lex=もつ, str=もっ, reading=もっ, count=-1, begin=4, end=6, correlation=0.0]
 - て [sequence=6, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=6, end=7, correlation=0.0]
 - 装飾 [sequence=7, facet=名詞, lex=装飾, str=装飾, reading=そうしょく, count=-1, begin=7, end=9, correlation=0.0]
 - する [sequence=8, facet=助動詞, lex=する, str=さ, reading=さ, count=-1, begin=9, end=10, correlation=0.0]
 - れる [sequence=9, facet=助動詞, lex=れる, str=れ, reading=れ, count=-1, begin=10, end=11, correlation=0.0]
 - べし [sequence=10, facet=助動詞, lex=べし, str=べき, reading=べき, count=-1, begin=11, end=13, correlation=0.0]
 - はず [sequence=11, facet=名詞, lex=はず, str=はず, reading=はず, count=-1, begin=13, end=15, correlation=0.0]
 - の [sequence=12, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=15, end=16, correlation=0.0]
 - 顔 [sequence=13, facet=名詞, lex=顔, str=顔, reading=かお, count=-1, begin=16, end=17, correlation=0.0]
 - が [sequence=14, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=17, end=18, correlation=0.0]
 - つるつる [sequence=15, facet=副詞, lex=つるつる, str=つるつる, reading=つるつる, count=-1, begin=18, end=22, correlation=0.0]
 - する [sequence=16, facet=動詞, lex=する, str=し, reading=し, count=-1, begin=22, end=23, correlation=0.0]
 - て [sequence=17, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=23, end=24, correlation=0.0]
 - まるで [sequence=18, facet=副詞, lex=まるで, str=まるで, reading=まるで, count=-1, begin=24, end=27, correlation=0.0]
 - 薬缶 [sequence=19, facet=名詞, lex=薬缶, str=薬缶, reading=やかん, count=-1, begin=27, end=29, correlation=0.0]
 - だ [sequence=20, facet=助動詞, lex=だ, str=だ, reading=だ, count=-1, begin=29, end=30, correlation=0.0]
 - 。 [sequence=21, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=30, end=31, correlation=0.0]
その後猫にもだいぶ逢ったがこんな片輪には一度も出会わした事がない。
 - その [sequence=1, facet=連体詞, lex=その, str=その, reading=その, count=-1, begin=0, end=2, correlation=0.0]
 - 後 [sequence=2, facet=名詞, lex=後, str=後, reading=あと, count=-1, begin=2, end=3, correlation=0.0]
 - 猫 [sequence=3, facet=名詞, lex=猫, str=猫, reading=ねこ, count=-1, begin=3, end=4, correlation=0.0]
 - に [sequence=4, facet=助詞, lex=に, str=に, reading=に, count=-1, begin=4, end=5, correlation=0.0]
 - も [sequence=5, facet=助詞, lex=も, str=も, reading=も, count=-1, begin=5, end=6, correlation=0.0]
 - だいぶ [sequence=6, facet=副詞, lex=だいぶ, str=だいぶ, reading=だいぶ, count=-1, begin=6, end=9, correlation=0.0]
 - 逢う [sequence=7, facet=動詞, lex=逢う, str=逢っ, reading=あっ, count=-1, begin=9, end=11, correlation=0.0]
 - た [sequence=8, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=11, end=12, correlation=0.0]
 - が [sequence=9, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=12, end=13, correlation=0.0]
 - こんな [sequence=10, facet=形容動詞, lex=こんな, str=こんな, reading=こんな, count=-1, begin=13, end=16, correlation=0.0]
 - 片輪 [sequence=11, facet=名詞, lex=片輪, str=片輪, reading=かたりん, count=-1, begin=16, end=18, correlation=0.0]
 - に [sequence=12, facet=助詞, lex=に, str=に, reading=に, count=-1, begin=18, end=19, correlation=0.0]
 - は [sequence=13, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=19, end=20, correlation=0.0]
 - 一度 [sequence=14, facet=名詞, lex=一度, str=一度, reading=いちど, count=-1, begin=20, end=22, correlation=0.0]
 - も [sequence=15, facet=助詞, lex=も, str=も, reading=も, count=-1, begin=22, end=23, correlation=0.0]
 - 出会う [sequence=16, facet=動詞, lex=出会う, str=出会わ, reading=であわ, count=-1, begin=23, end=26, correlation=0.0]
 - する [sequence=17, facet=助動詞, lex=する, str=し, reading=し, count=-1, begin=26, end=27, correlation=0.0]
 - た [sequence=18, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=27, end=28, correlation=0.0]
 - 事 [sequence=19, facet=名詞, lex=事, str=事, reading=こと, count=-1, begin=28, end=29, correlation=0.0]
 - が [sequence=20, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=29, end=30, correlation=0.0]
 - ない [sequence=21, facet=形容詞, lex=ない, str=ない, reading=ない, count=-1, begin=30, end=32, correlation=0.0]
 - 。 [sequence=22, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=32, end=33, correlation=0.0]
のみならず顔の真中があまりに突起している。
 - のみならず [sequence=1, facet=接続詞, lex=のみならず, str=のみならず, reading=のみならず, count=-1, begin=0, end=5, correlation=0.0]
 - 顔 [sequence=2, facet=名詞, lex=顔, str=顔, reading=かお, count=-1, begin=5, end=6, correlation=0.0]
 - の [sequence=3, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=6, end=7, correlation=0.0]
 - 真中 [sequence=4, facet=名詞, lex=真中, str=真中, reading=まんなか, count=-1, begin=7, end=9, correlation=0.0]
 - が [sequence=5, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=9, end=10, correlation=0.0]
 - あまり [sequence=6, facet=副詞, lex=あまり, str=あまり, reading=あまり, count=-1, begin=10, end=13, correlation=0.0]
 - に [sequence=7, facet=助詞, lex=に, str=に, reading=に, count=-1, begin=13, end=14, correlation=0.0]
 - 突起 [sequence=8, facet=名詞, lex=突起, str=突起, reading=とっき, count=-1, begin=14, end=16, correlation=0.0]
 - する [sequence=9, facet=助動詞, lex=する, str=し, reading=し, count=-1, begin=16, end=17, correlation=0.0]
 - て [sequence=10, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=17, end=18, correlation=0.0]
 - いる [sequence=11, facet=助動詞, lex=いる, str=いる, reading=いる, count=-1, begin=18, end=20, correlation=0.0]
 - 。 [sequence=12, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=20, end=21, correlation=0.0]
そうしてその穴の中から時々ぷうぷうと煙を吹く。
 - そう [sequence=1, facet=副詞, lex=そう, str=そう, reading=そう, count=-1, begin=0, end=2, correlation=0.0]
 - する [sequence=2, facet=動詞, lex=する, str=し, reading=し, count=-1, begin=2, end=3, correlation=0.0]
 - て [sequence=3, facet=助詞, lex=て, str=て, reading=て, count=-1, begin=3, end=4, correlation=0.0]
 - その [sequence=4, facet=連体詞, lex=その, str=その, reading=その, count=-1, begin=4, end=6, correlation=0.0]
 - 穴 [sequence=5, facet=名詞, lex=穴, str=穴, reading=あな, count=-1, begin=6, end=7, correlation=0.0]
 - の [sequence=6, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=7, end=8, correlation=0.0]
 - 中 [sequence=7, facet=名詞, lex=中, str=中, reading=なか, count=-1, begin=8, end=9, correlation=0.0]
 - から [sequence=8, facet=助詞, lex=から, str=から, reading=から, count=-1, begin=9, end=11, correlation=0.0]
 - 時々 [sequence=9, facet=名詞, lex=時々, str=時々, reading=ときどき, count=-1, begin=11, end=13, correlation=0.0]
 - ぷう [sequence=10, facet=名詞, lex=ぷう, str=ぷう, reading=ぷう, count=-1, begin=13, end=15, correlation=0.0]
 - ぷう [sequence=11, facet=名詞, lex=ぷう, str=ぷう, reading=ぷう, count=-1, begin=13, end=15, correlation=0.0]
 - と [sequence=12, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=17, end=18, correlation=0.0]
 - 煙 [sequence=13, facet=名詞, lex=煙, str=煙, reading=けむり, count=-1, begin=18, end=19, correlation=0.0]
 - を [sequence=14, facet=助詞, lex=を, str=を, reading=を, count=-1, begin=19, end=20, correlation=0.0]
 - 吹く [sequence=15, facet=動詞, lex=吹く, str=吹く, reading=ふく, count=-1, begin=20, end=22, correlation=0.0]
 - 。 [sequence=16, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=22, end=23, correlation=0.0]
どうも咽せぽくて実に弱った。
 - どう [sequence=1, facet=副詞, lex=どう, str=どう, reading=どう, count=-1, begin=0, end=2, correlation=0.0]
 - も [sequence=2, facet=助詞, lex=も, str=も, reading=も, count=-1, begin=2, end=3, correlation=0.0]
 - 咽せる [sequence=3, facet=動詞, lex=咽せる, str=咽せ, reading=むせ, count=-1, begin=3, end=5, correlation=0.0]
 - ぽ [sequence=4, facet=特殊, lex=ぽ, str=ぽ, reading=ぽ, count=-1, begin=5, end=6, correlation=0.0]
 - くう [sequence=5, facet=動詞, lex=くう, str=く, reading=く, count=-1, begin=6, end=7, correlation=0.0]
 - てる [sequence=6, facet=助動詞, lex=てる, str=て, reading=て, count=-1, begin=7, end=8, correlation=0.0]
 - 実に [sequence=7, facet=副詞, lex=実に, str=実に, reading=じつに, count=-1, begin=8, end=10, correlation=0.0]
 - 弱る [sequence=8, facet=動詞, lex=弱る, str=弱っ, reading=よわっ, count=-1, begin=10, end=12, correlation=0.0]
 - た [sequence=9, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=12, end=13, correlation=0.0]
 - 。 [sequence=10, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=13, end=14, correlation=0.0]
これが人間の飲む煙草というものである事はようやくこの頃知った。
 - これ [sequence=1, facet=名詞, lex=これ, str=これ, reading=これ, count=-1, begin=0, end=2, correlation=0.0]
 - が [sequence=2, facet=助詞, lex=が, str=が, reading=が, count=-1, begin=2, end=3, correlation=0.0]
 - 人間 [sequence=3, facet=名詞, lex=人間, str=人間, reading=にんげん, count=-1, begin=3, end=5, correlation=0.0]
 - の [sequence=4, facet=助詞, lex=の, str=の, reading=の, count=-1, begin=5, end=6, correlation=0.0]
 - 飲む [sequence=5, facet=動詞, lex=飲む, str=飲む, reading=のむ, count=-1, begin=6, end=8, correlation=0.0]
 - 煙草 [sequence=6, facet=名詞, lex=煙草, str=煙草, reading=たばこ, count=-1, begin=8, end=10, correlation=0.0]
 - と [sequence=7, facet=助詞, lex=と, str=と, reading=と, count=-1, begin=10, end=11, correlation=0.0]
 - いう [sequence=8, facet=動詞, lex=いう, str=いう, reading=いう, count=-1, begin=11, end=13, correlation=0.0]
 - もの [sequence=9, facet=名詞, lex=もの, str=もの, reading=もの, count=-1, begin=13, end=15, correlation=0.0]
 - だ [sequence=10, facet=助動詞, lex=だ, str=で, reading=で, count=-1, begin=15, end=16, correlation=0.0]
 - ある [sequence=11, facet=助動詞, lex=ある, str=ある, reading=ある, count=-1, begin=16, end=18, correlation=0.0]
 - 事 [sequence=12, facet=名詞, lex=事, str=事, reading=こと, count=-1, begin=18, end=19, correlation=0.0]
 - は [sequence=13, facet=助詞, lex=は, str=は, reading=は, count=-1, begin=19, end=20, correlation=0.0]
 - ようやく [sequence=14, facet=副詞, lex=ようやく, str=ようやく, reading=ようやく, count=-1, begin=20, end=24, correlation=0.0]
 - この [sequence=15, facet=連体詞, lex=この, str=この, reading=この, count=-1, begin=24, end=26, correlation=0.0]
 - 頃 [sequence=16, facet=名詞, lex=頃, str=頃, reading=ころ, count=-1, begin=26, end=27, correlation=0.0]
 - 知る [sequence=17, facet=動詞, lex=知る, str=知っ, reading=しっ, count=-1, begin=27, end=29, correlation=0.0]
 - た [sequence=18, facet=助動詞, lex=た, str=た, reading=た, count=-1, begin=29, end=30, correlation=0.0]
 - 。 [sequence=19, facet=特殊, lex=。, str=。, reading=。, count=-1, begin=30, end=31, correlation=0.0]


```


# まとめ

NLP4J を使うと、Javaで簡単に自然言語処理ができますね！


#プロジェクトURL
https://www.nlp4j.org/
<img width="64" alt="NLP4J_N_128.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/110265/4f59b21b-4b43-187d-0aac-7b99c0fd4bac.png">

---
[Indexに戻る](https://qiita.com/oyahiroki/items/ba79a759c599d3459d29)