Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby script to test of mecab.
# -*- encoding: utf-8 -*-
require 'MeCab'
sentence = "太郎はこの本を二郎を見た女性に渡した。"
begin
c = MeCab::Tagger.new
n = c.parseToNode(sentence)
while n do
print n.surface, "\t", n.feature, "\t", n.cost, "\n"
n = n.next
end
print "EOS\n";
rescue
print "RuntimeError: ", $!, "\n";
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.