-
-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
- Loading branch information
Showing
26 changed files
with
971 additions
and
554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
""" | ||
标调位置 | ||
有 ɑ 不放过, | ||
没 ɑ 找 o、e; | ||
ɑ、o、e、i、u、ü | ||
标调就按这顺序; | ||
i、u 若是连在一起, | ||
谁在后面就标谁。 | ||
http://www.hwjyw.com/resource/content/2010/06/04/8183.shtml | ||
https://www.zhihu.com/question/23655297 | ||
https://github.com/mozillazg/python-pinyin/issues/160 | ||
http://www.pinyin.info/rules/where.html | ||
""" | ||
|
||
|
||
def right_mark_index(pinyin_no_tone): | ||
# 有 ɑ 不放过, 没 ɑ 找 o、e | ||
for c in ['a', 'o', 'e']: | ||
if c in pinyin_no_tone: | ||
return pinyin_no_tone.index(c) | ||
|
||
# i、u 若是连在一起,谁在后面就标谁 | ||
for c in ['iu', 'ui']: | ||
if c in pinyin_no_tone: | ||
return pinyin_no_tone.index(c) + 1 | ||
|
||
# ɑ、o、e、i、u、ü | ||
for c in ['i', 'u', 'v', 'ü']: | ||
if c in pinyin_no_tone: | ||
return pinyin_no_tone.index(c) | ||
|
||
# n, m, ê | ||
for c in ['n', 'm', 'ê']: | ||
if c in pinyin_no_tone: | ||
return pinyin_no_tone.index(c) | ||
# 向后兼容 | ||
from pypinyin.style._tone_rule import right_mark_index # noqa |
Oops, something went wrong.