Skip to content

Instantly share code, notes, and snippets.

@soomtong
Forked from elegantcoder/korean_marker.rb
Created February 16, 2019 11:41
Show Gist options
  • Save soomtong/37e3a93d894243ef9fd42588663f3171 to your computer and use it in GitHub Desktop.
Save soomtong/37e3a93d894243ef9fd42588663f3171 to your computer and use it in GitHub Desktop.
한글 은/는, 이/가 (Powered by ActiveSupport::Multibyte::Chars)
# require 'active_support/all'
def korean_topic_marker(str)
k = str[-1] # last one char
return '는' if k.mb_chars.decompose.size < 3 # 종성이 없는 경우
return '은'
end
def korean_subject_marker(str)
k = str[-1] # last one char
return '가' if k.mb_chars.decompose.size < 3 # 종성이 없는 경우
return '이'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment