Skip to main content

将汉语转换为“伪日本语”.

Project description

Yukkuri-Mandarin: 油库里普通话

PyPI - Version Python Version License: MIT Type Checked OS Independent

欢迎来到油库里普通话!

油库里普通话(Yukkuri-Mandarin)是一个尝试使用日语的假名(五十音)系统来模拟拼读现代汉语普通话的Python包。

“伪中国语”(偽中国語 / ぎちゅうごくご)是一种基于日语逻辑,但不使用日语中的假名,仅通过汉字来构建句子的语言游戏形式。反过来,仅使用日语假名来拼读普通话发音形成的“句子”或可称之为“伪日本语”。例如“油库里普通话”,使用平假名模拟其音节将是“よう くう りい ぷう とん ふわ”。同时,基于日语高低音模式模拟普通话声调,得到类似“ よ/̅う̅く̅\うりいぷう/̅と̅ん̅ふ̅\わ”的结果。

目前,现有的普通话->假名转换工具大部分仅能实现音节的模拟,而不能还原声调。如果直接利用其输出的结果生成油库里语音将得到类似“棒读”的机械发音。本项目在实现这些功能的基础上,借助语音合成软件的“音声记号”,在输出结果中标记高低音形成声调拟音,使发音更加接近普通话。您可以将转换结果用于AquesTalkPlayer油库里MovieMaker和其他支持音声记号的语音合成工具,以实现中文油库里语音的合成。此外,本项目还提供了拼音数据库管理功能,如果您对某个字的发音不满意,或者某些生僻字缺少发音,您可以方便地自定义发音数据。祝您玩得愉快~

让我们说中文!

目录

安装方法

:star: (推荐) 安装所有可选依赖项:

pip install yukkuri-mandarin[all]

不带可选依赖项:

pip install yukkuri-mandarin

使用可选依赖项 jieba 进行分词可以提高多音字读音准确性:

pip install yukkuri-mandarin[jieba]

如果要使用导出/导入Excel文档的功能,请安装可选依赖项 openpyxl

pip install yukkuri-mandarin[openpyxl]

如果要从本地安装/给无法联网的设备安装/从源码编译安装,请看更多安装方式

使用方法

将中文句子转换为“伪日本语”:

import yukkurimandarin as ym

result = ym.text_convert("油库里普通话。")
print(result)

将汉语拼音句子(以空格分开音节,各音节末尾添加表示声调的数字)转换为“伪日本语”:

import yukkurimandarin as ym

result = ym.pinyin_convert("you2 ku4 li3 pu3 tong1 hua4 .")
print(result)

请查看更详细的使用方法介绍

环境与依赖

  • 支持 Python 3.9 及以上。

  • 必需依赖:

  • 可选依赖:

谨在此向上述包的开发者们表达感谢!

常见问题

Q: 我需要有日语基础吗?

A: 不需要。 但是如果您掌握了假名发音将帮助您调整您不满意的发音数据。

Q: 某个音读错了/缺少某个音/我想修改某个音

A: 请使用拼音数据库管理模块。

Q: 发音没有声调,而且断断续续?

A: 请先阅读使用方法介绍。同时,确认您使用的语音合成软件是否支持音声记号

Q: 为什么无法生成油库里语音?

A: 请首先检查转换后的假名拟音中是否包含非法字符。具体请查看使用方法介绍

Q: 我遇到了问题/我有一个建议/我需要某个功能

A: 请在issue板块提出,或者给作者发邮件:wubzbz@126.com

更新日志

1.0.3

  • 优化了对“不”字变调的支持。例如:“不对” -> "bu2 dui4"。
  • 订正了油库里语音的介绍。
  • 增加了面向ゆっくも!的使用说明。
  • 修复了modify_consecutive_threes()潜在的数组越界漏洞。
  • CI工作流不再在push时触发(避免重复)。

查看更新历史

附注

  • 作者在制作题图时使用了人工智能辅助。
  • 题图中的人物“雾雨魔理沙”形象的原作者为:©上海アリス幻樂団。
  • yukkurimandarin is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yukkuri_mandarin-1.0.3.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yukkuri_mandarin-1.0.3-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file yukkuri_mandarin-1.0.3.tar.gz.

File metadata

  • Download URL: yukkuri_mandarin-1.0.3.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yukkuri_mandarin-1.0.3.tar.gz
Algorithm Hash digest
SHA256 ec135e628d8dc5e62c537575d990a66ab40e8235b21d90edf4ed97854181f9af
MD5 64d159908397481bb5567e9abcf9cb6a
BLAKE2b-256 bb8f6da2a63baca13d608b4bc76c1556e03019fcd33d0600256d2f96124aec56

See more details on using hashes here.

Provenance

The following attestation bundles were made for yukkuri_mandarin-1.0.3.tar.gz:

Publisher: CD.yml on wubzbz/Yukkuri-Mandarin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yukkuri_mandarin-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for yukkuri_mandarin-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 42b8c64ed575ff4ea4b30bcc7923fab924c9c10529edd0f701bfaef6f5d7f6f7
MD5 15d184791e67653ca800ffc59f90e302
BLAKE2b-256 a9bfd3ca0b9a45a4a880379afb211e04e77695ebe5b04f66ce0734f93adf602e

See more details on using hashes here.

Provenance

The following attestation bundles were made for yukkuri_mandarin-1.0.3-py3-none-any.whl:

Publisher: CD.yml on wubzbz/Yukkuri-Mandarin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page