Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于口语化词“哟”和“哦”发音完全一样的bug #282

Closed
Mortyzhou-Shef-BIT opened this issue Jun 21, 2022 · 1 comment
Closed
Labels

Comments

@Mortyzhou-Shef-BIT
Copy link

Mortyzhou-Shef-BIT commented Jun 21, 2022

运行环境

  • 操作系统(Linux/macOS/Windows):Linux
  • Python 版本:3.9
  • pypinyin 版本:0.46.0

问题描述

pypinyin目前对于一些口语化词的表达有很严重的问题,如最常见的“哟”,转换出来的initials是空的,而finals是不在《汉语拼音方案》中列出的韵母“io”
origin_img_v2_eabf859c-c155-47bf-91be-7c8f48f534ag

当您更改了 #266 的问题之后:
origin_img_v2_13523eaf-7d30-4860-8e44-9096f29ae11g
然后由于io不在_FINAL里面,直接return了“o”....
哟的读音直接和哦一样了....
是否可以提供类似“哟”这样的口语化词的合适的表达方式?能不能在生成“哟”的过程中赋予其initial“y”?

问题复现步骤

@mozillazg
Copy link
Owner

@Mortyzhou-Shef-BIT
对于你的这个需求,可以通过指定 strict=False 来实现:

>>> lazy_pinyin('哟哟切克闹', style=Style.INITIALS, strict=False)
 ['y', 'y', 'q', 'k', 'n']

>>> lazy_pinyin('哟哟切克闹', style=Style.FINALS, strict=False)
 ['o', 'o', 'ie', 'e', 'ao']

详见 README 里对这种场景的说明:https://github.com/mozillazg/python-pinyin#%E4%B8%BA%E4%BB%80%E4%B9%88%E6%B2%A1%E6%9C%89-y-w-yu-%E5%87%A0%E4%B8%AA%E5%A3%B0%E6%AF%8D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants