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: 请在issue板块提出,或者给作者发邮件:wubzbz@126.com

更新日志

1.0.2

  • 优化(?)了部分发音。
    • 对于一些音节,缩短了其对应假名的拍数。例如-uo:うお ->
    • 将一些拍数较多的假名升/降调的时机后移。例如dian:でぃ/あん -> でぃあ/ん
    • 参见commit中对generate_gana.py的修改。
  • 优化了jieba分词器初始化逻辑,抑制INFO级日志输出。
  • 更新了许可证。

查看更新历史

附注

  • 作者在制作题图时使用了人工智能辅助。
  • 题图中的人物“雾雨魔理沙”形象的原作者为:©上海アリス幻樂団。
  • 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.2.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.2-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yukkuri_mandarin-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2257aeb25c90e9c1459cdec46977f497601f0ceafead96c5e21ab2f6560298d5
MD5 de5ce83704d22ca2dc43ba4cb4f27e04
BLAKE2b-256 b30d8bab768e7ba87604169331b63962b243e0e7fc0f5ed5ae4911e4d57680a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for yukkuri_mandarin-1.0.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yukkuri_mandarin-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 85990872dd00c4e57c666c7388ec6a90cf5f61ebe69646554f155e23815b9bcf
MD5 3ca6f67f0b1d733b4ce76a1be00dec0f
BLAKE2b-256 422ec5829d1819a3a61fa470162afde835ce60670871250fbebcf34417e202d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for yukkuri_mandarin-1.0.2-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