LoginSignup
2
2

More than 5 years have passed since last update.

jrubyからkuromojiを使う

Last updated at Posted at 2014-12-20
#encoding: UTF-8

require 'java'

java_import org.atilika.kuromoji.Token
java_import org.atilika.kuromoji.Tokenizer

tokenizer = Tokenizer.builder().build();

tokens =  tokenizer.tokenize(ARGV[0]).iterator
while tokens.hasNext
  token = tokens.next
  puts token.getSurfaceForm() + "\t" + token.getAllFeatures()
end
$ jruby -J-cp kuromoji-0.7.7/lib/kuromoji-0.7.7.jar test_tokenize.rb "ガンダムユニコーン"
ガンダムユニコーン 名詞,固有名詞,組織,*,*,*,*
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2