Skip to content

Instantly share code, notes, and snippets.

@yoshiokatsuneo
Created November 30, 2012 23:05
Show Gist options
  • Save yoshiokatsuneo/4179338 to your computer and use it in GitHub Desktop.
Save yoshiokatsuneo/4179338 to your computer and use it in GitHub Desktop.
Finnish kpt changing in one line ruby
ruby -pe 'BEGIN{kpt="k:,p:v,t:d,kk:k,pp:p,tt:t,nk:ng,nt:nn,lt:ll,rt:rr,sk:sk,tk:tk,sp:sp,st:st"; kpt_h=Hash[*(kpt.split(/[:,]/))]}; $_.gsub!(Regexp.new("(" + kpt_h.keys.join("|") + ")(.\n?)$")){kpt_h[$1] + $2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment