-
-
Notifications
You must be signed in to change notification settings - Fork 628
Add pinyin_group and lazy_pinyin_group functions for grouped pinyin output with apostrophe handling #357
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
base: develop
Are you sure you want to change the base?
Add pinyin_group and lazy_pinyin_group functions for grouped pinyin output with apostrophe handling #357
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Co-authored-by: mozillazg <485054+mozillazg@users.noreply.github.com>
Co-authored-by: mozillazg <485054+mozillazg@users.noreply.github.com>
…up method Co-authored-by: mozillazg <485054+mozillazg@users.noreply.github.com>
Co-authored-by: mozillazg <485054+mozillazg@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix flake8 errors: E129 (visual indent), E501 (line too long), F401 (unused import).
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
* chore: migrate project management and CI/CD to uv - Add pyproject.toml and uv.lock for uv-based dependency management. - Update Makefile to use 'uv build' for package building. - Update .github/workflows/ci.yml to use astral-sh/setup-uv and uv commands. - Update .circleci/config.yml to install and use uv for testing. - Add uv installation instructions to README.rst and README_en.rst. * fix ci * no longer support pypy2 * use astral-sh/setup-uv@v7
…b-dabd-4427-9b7a-3261a7d65bf9
Successfully implemented pinyin grouping functions with two variants for different use cases:
New Functions
1.
pinyin_group()andlazy_pinyin_group()pinyin_group: Returns pinyin as a list (supports multi-pronunciation withheteronym=True)lazy_pinyin_group: Returns pinyin as a string (single pronunciation only, simpler output)Both functions:
Handle erhua (儿化音) - combine 儿 with previous characterImplementation Details
Architecture (following existing patterns)
Pinyin.pinyin_group()andPinyin.lazy_pinyin_group()methods in thePinyinclasspinyin()/lazy_pinyin()functionsKey Differences
pinyin_group:
[{'hanzi': '你好', 'pinyin': ['ni hao']}] # pinyin is a listlazy_pinyin_group:
[{'hanzi': '你好', 'pinyin': 'ni hao'}] # pinyin is a stringUse Cases
pinyin_group: When you need multi-pronunciation support or consistency with other functionslazy_pinyin_group: Simpler output for common cases where single pronunciation is sufficient<ruby>tag integration for annotating Chinese textTesting
Exports
Both functions are exported from
pypinyin/__init__.py:pinyin_grouplazy_pinyin_groupType hints added to
.pyifiles for both functions and methods.Closes #245
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.