require 'lindera'
project_root = File.expand_path('..', __dir__)
dictionary = Lindera.load_dictionary('embedded://ipadic')
metadata = dictionary.metadata
user_dictionary_path = File.join(project_root, 'resources', 'ipadic_simple_userdic.csv')
user_dictionary = Lindera.load_user_dictionary(user_dictionary_path, metadata)
tokenizer = Lindera::Tokenizer.new(dictionary, 'normal', user_dictionary)
text = '関西国際空港限定トートバッグを東京スカイツリーの最寄り駅であるとうきょうスカイツリー駅で買う'
puts "text: #{text}\n\n"
tokens = tokenizer.tokenize(text)
tokens.each do |token|
puts token.surface
end