Sha256: 4ba21d3b506f956745f58585d45dc1621145e5d699a16cbe6984b0cc2ef2ec05

Contents?: true

Size: 563 Bytes

Versions: 4

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.chars.last)
            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

4 entries across 4 versions & 1 rubygems

Version Path
ting-0.12.0 lib/ting/tones/ipa.rb
ting-0.11.0 lib/ting/tones/ipa.rb
ting-0.10.0 lib/ting/tones/ipa.rb
ting-0.9.0 lib/ting/tones/ipa.rb