Skip to main content

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.

Metadata

Release files for yukkuri-mandarin 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yukkuri-mandarin 1.0.3
File Size Uploaded
yukkuri_mandarin-1.0.3.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for yukkuri-mandarin 1.0.3
File Interpreter ABI Platform
yukkuri_mandarin-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / yukkuri_mandarin-1.0.3.tar.gz

Download URL yukkuri_mandarin-1.0.3.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
ec135e628d8dc5e62c537575d990a66ab40e8235b21d90edf4ed97854181f9af
BLAKE2b-256 checksum
How to use checksums
bb8f6da2a63baca13d608b4bc76c1556e03019fcd33d0600256d2f96124aec56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.

Transparency log

Release files / yukkuri_mandarin-1.0.3-py3-none-any.whl

Download URL yukkuri_mandarin-1.0.3-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
42b8c64ed575ff4ea4b30bcc7923fab924c9c10529edd0f701bfaef6f5d7f6f7
BLAKE2b-256 checksum
How to use checksums
a9bfd3ca0b9a45a4a880379afb211e04e77695ebe5b04f66ce0734f93adf602e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page