Last active
January 15, 2016 12:53
-
-
Save sasanquaneuf/86b0f4b39051792d6a11 to your computer and use it in GitHub Desktop.
Windows10(64bit)のRubyでMeCabをつかう(Natto) ref: http://qiita.com/sasanquaneuf/items/e4e57b60d04b75d68f80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> gem install natto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> cd c:\temp\mecab | |
> ruby mecab.rb > temp.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> mecab input.txt -o out.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'natto' | |
text = '日本語を分解してしまいます。' | |
natto = Natto::MeCab.new | |
natto.parse(text) do |n| | |
puts "#{n.surface}: #{n.feature}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
日本語 名詞,一般,*,*,*,*,日本語,ニホンゴ,ニホンゴ | |
を 助詞,格助詞,一般,*,*,*,を,ヲ,ヲ | |
分解 名詞,サ変接続,*,*,*,*,分解,ブンカイ,ブンカイ | |
し 動詞,自立,*,*,サ変・スル,連用形,する,シ,シ | |
て 助詞,接続助詞,*,*,*,*,て,テ,テ | |
しまい 動詞,非自立,*,*,五段・ワ行促音便,連用形,しまう,シマイ,シマイ | |
ます 助動詞,*,*,*,特殊・マス,基本形,ます,マス,マス | |
。 記号,句点,*,*,*,*,。,。,。 | |
EOS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
日本語: 名詞,一般,*,*,*,*,日本語,ニホンゴ,ニホンゴ | |
を: 助詞,格助詞,一般,*,*,*,を,ヲ,ヲ | |
分解: 名詞,サ変接続,*,*,*,*,分解,ブンカイ,ブンカイ | |
し: 動詞,自立,*,*,サ変・スル,連用形,する,シ,シ | |
て: 助詞,接続助詞,*,*,*,*,て,テ,テ | |
しまい: 動詞,非自立,*,*,五段・ワ行促音便,連用形,しまう,シマイ,シマイ | |
ます: 助動詞,*,*,*,特殊・マス,基本形,ます,マス,マス | |
。: 記号,句点,*,*,*,*,。,。,。 | |
: BOS/EOS,*,*,*,*,*,*,*,* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment