feat: add hiragana furigana option#90
Open
kongjianguan wants to merge 3 commits into
Open
Conversation
added 2 commits
May 22, 2026 11:22
Add a "平假名" checkbox that converts romaji text to hiragana (no spaces) when enabled. The checkbox is conditionally enabled only when the "罗马音" checkbox is checked. - LDDC/core/romaji.py: new romaji→hiragana converter (pure Python) - tests/test_romaji.py: 73 unit tests covering all conversion patterns - 5 view UIs: add kana_checkBox next to romanized_checkBox - 5 view controllers: wire conditional enable + cfg["kana"] toggle - gui/service.py: convert roma line to kana during desktop lyrics render - core/converter/__init__.py: convert before export/save-to-tag/preview - config.py: add "kana": False default config entry
The romaji→kana conversion block in convert2() creates FSLyricsData/FSLyricsLine/FSLyricsWord instances but these were not imported, causing a silent NameError that left the lyrics preview stuck on "处理中...".
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 23 |
| Duplication | 4 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
- converter/__init__.py: remove duplicate cfg import, sort imports - romaji.py: add missing blank line after "Returns" docstring section
Author
|
本地测试功能,没发现问题 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
新增"平假名"复选框,将罗马字文本行转换为无空格的平假名。该复选框仅在"罗马音"勾选时才可启用。
改动内容
LDDC/core/romaji.py— 纯 Python 罗马字→平假名转换器,包含完整音节表,采用最长前缀匹配策略。无法映射的 token(英文、数字等)原样保留。kana_checkBox。service.py)converter/__init__.py)cfg["kana"]布尔值(默认false)'t→っ)、混合文本和边界情况。视觉效果
ko re wa ha na ga sa ku(带空格的罗马字)これははながさく(无空格平假名)测试计划
pytest tests/test_romaji.py -v— 73/73 通过