Skip to content

Instantly share code, notes, and snippets.

@sasamijp sasamijp/wailang.rb
Created Aug 16, 2015

Embed
What would you like to do?
日本語をわいらの言葉に変換するやで
# -*- encoding:utf-8 -*-
require 'natto'
@natto = Natto::MeCab.new
def conv(jp_text)
words = []
@natto.parse(jp_text) do |n|
break if n.is_eos?
case n.feature.split(',')[0]
when '名詞'
words << 'わい'
else words << n.surface
end
end
words.join('')
end
puts conv gets.chomp
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.