Sha256: 6e75114bf5259d5bb7f83c3e77dab75bd18324439b3b36c3ac38c357ca9bce4d
Contents?: true
Size: 519 Bytes
Versions: 2
Compression:
Stored size: 519 Bytes
Contents
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) return t if t = GLYPHS.index(syll.chars[-1]) return NEUTRAL_TONE end def pop_tone(syll) [ peek_tone(syll), syll[/\A[^#{GLYPHS.join}]+/] ] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ting-0.2.1 | lib/ting/tones/ipa.rb |
ting-0.2.0 | lib/ting/tones/ipa.rb |