Open zhustec opened 9 years ago
@hongliang-goudou 这个是你转换的,知道是什么原因吗?
@flyerhzm 并不是转换的问题,是 Mandarin.dat 里面 5
@wittyfox 5 应该是轻声吧 http://baike.baidu.com/view/1632699.htm
@flyerhzm 恩,刚才回头补了下汉语拼音也发现了,但是 5 应该改成 0 才可以,或者把调整一下 TONE_MARK
然后用 tone_index - 1
访问
tone_index 1 2 3 4 分别是 4 个声,5 是什么?而且有 91 个有 5.
如果
tone_index
是 5 的话,下面代码就会出错代码来自 (https://github.com/flyerhzm/chinese_pinyin/blob/master/lib/chinese_pinyin.rb#L86-L90)
因为每个
TONE_MARK[v.to_sym]
都只有 5 个元素,因此会取到nil
,再进行tr!
就会报错。有些字的第一个拼音的
tone
不是 5,所以不会出问题。但也有不少字的第一个拼音的tone
是 5,这些字转成拼音都会报错.