class String

Constants

FUKU_PARTICLE
KAKU_PARTICLE
SETSUZOKU_PARTICLE
SHUU_PARTICLE

Public Instance Methods

saitonized() click to toggle source
# File lib/saitonized.rb, line 15
def saitonized
  natto_mecab = Natto::MeCab.new
  res = ''
  natto_mecab.parse(self) do |nm|
    res += case nm.feature
    when /格助詞/ then KAKU_PARTICLE.sample
    when /接続助詞/ then SETSUZOKU_PARTICLE.sample
    when /副助詞/ then FUKU_PARTICLE.sample
    when /終助詞/ then SHUU_PARTICLE.sample
    else nm.surface
    end
  end
  res
end