Sha256: a4b8eed6c8c0f102e32d25b88f89bf3329d2f80bcd58751c4918f726bf742409
Contents?: true
Size: 563 Bytes
Versions: 1
Compression:
Stored size: 563 Bytes
Contents
# coding: utf-8 module Ting module Tones class Ipa < Tone class <<self GLYPHS=['', '˥˥', '˧˥', '˧˩˧', '˥˩',] #http://wapedia.mobi/en/Wikipedia:IPA_for_Mandarin def add_tone(syll,tone) syll + GLYPHS[normalize(tone) % 5] end def peek_tone(syll) if t = GLYPHS.index(syll.uchars[-1]) return t end return NEUTRAL_TONE end def pop_tone(syll) [ peek_tone(syll), syll[/\A[^#{GLYPHS.join}]+/] ] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ting-0.3.0 | lib/ting/tones/ipa.rb |