s2t / s2tw / s2twp 詞語交界誤轉:量子、組織、被發明與助詞「了」等案例
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cmake, cpp
- Domain
- localization, testing-qa
Research direction
Build OpenCC with the provided CMake commands, then reproduce the cases through src/tools/opencc using s2t.json, s2tw.json, and s2twp.json. Use --inspect to trace segmentation, and review TWPhrases.txt and STPhrases.txt around the reported matches. Done means the listed outputs are corrected without breaking the supplied comparison cases, with regression tests covering the reproductions.
Written by the indexing model from the issue text.
Description
使用 OpenCC 將簡體電子書轉為臺灣繁體時,遇到幾組疑似跨詞匹配造成的誤轉。以下已縮減為可獨立重現的短字串,並使用官方原生 CLI 與原版詞庫重新測試,未套用自訂詞庫或後處理。
測試版本
- OpenCC
1.4.2+gf509f2f,commitf509f2f0ed60cf670f44796a5da3746d974e8892。 - 配置:
s2t.json、s2tw.json、s2twp.json。 - 官方 Python 套件 OpenCC 1.4.1 也得到相同結果。
- 下列結果限上述標準配置;尚未測試選用的 Jieba 配置。
實際結果與預期結果
前三項只在 s2twp 出現;後六項在上述三種配置都會出現。
| 輸入 | 實際輸出 | 預期輸出 | 出現問題的配置 |
|---|---|---|---|
| 改变量子比特 | 改變數子位元 | 改變量子位元 | s2twp |
| 少数组织 | 少陣列織 | 少數組織 | s2twp |
| 聚集成群 | 聚整合群 | 聚集成群 | s2twp |
| 被发明 | 被髮明 | 被發明 | s2t / s2tw / s2twp |
| 被发掘 | 被髮掘 | 被發掘 | s2t / s2tw / s2twp |
| 展示了如何 | 展示瞭如何 | 展示了如何 | s2t / s2tw / s2twp |
| 学习了如何 | 學習瞭如何 | 學習了如何 | s2t / s2tw / s2twp |
| 了解了如何 | 瞭解瞭如何 | 瞭解了如何 | s2t / s2tw / s2twp |
| 参与制造 | 參與制造 | 參與製造 | s2t / s2tw / s2twp |
這些字串分別表示「改變/量子比特」「少數/組織」「聚集/成群」、被動語態的「被/發明、發掘」、助詞「了/如何」,以及「參與/製造」。
重現方式
在該 commit 的原始碼根目錄建置:
cmake -S . -B build/review -DBUILD_OPENCC_JIEBA_PLUGIN=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build build/review -j 4
使用同一次建置產生的 CLI 與詞庫:
for config in s2t s2tw s2twp; do
printf '%s\n' "$config"
build/review/src/tools/opencc \
-c "data/config/$config.json" --path build/review/data <<'EOF'
改变量子比特
少数组织
聚集成群
被发明
被发掘
展示了如何
学习了如何
了解了如何
参与制造
EOF
done
--inspect 觀察
依轉換階段與分詞結果,可以分成四組:
- 臺灣詞彙階段跨詞匹配。 前三例在第一階段得到
改變量子比特、少數組織、聚集成羣,下一階段才出現誤轉。對應到TWPhrases.txt的變量→變數、數組→陣列、集成→整合。 - 「被发」前綴。
被发明、被发掘分別被切成[被发, 明]、[被发, 掘],命中STPhrases.txt的被发→被髮。 - 助詞「了」與「如何」的交界。 例如
了解了如何被切成[了解, 了如, 何],其中了如→瞭如造成第二個「了」誤轉。單獨輸入了解了則正確得到瞭解了,所以重現時需要保留「如何」。 - 「参与制」前綴。
参与制造被切成[参与制, 造],命中参与制→參與制,使「製造」的「製」未被轉換;單獨輸入制造則會得到製造。
例如,可用以下指令查看完整分詞與轉換階段:
printf '%s' '了解了如何' | build/review/src/tools/opencc \
-c data/config/s2t.json --path build/review/data --inspect
想請教這幾組案例是否適合以詞組例外或分詞保護處理,並補上回歸測試。以下目前正確的對照結果也可供評估修正影響:变量→變數、数组→陣列、集成电路→積體電路、被发左衽→被髮左衽、了如指掌→瞭如指掌、参与制度→參與制度(上述對照均以 s2twp 測試)。
相關討論:發/髮的語境問題 #1059、小說轉換問題 #1277。另有 #1313 討論一般詞彙的過度轉換;本次先集中回報上述可重現的詞語交界案例。
謝謝維護者。
- Dominant language
- C++
- Stars
- 10.1k
- Forks
- 1.1k
- Avg merge
- 47m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BYVoid/OpenCC
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
术忽 → 朮忽 should be the s2t mapping (currently 術忽)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
-
update TWPhrasesOther.txtMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
「100人参加了这次活动」转化错误May be free again A pull request for this issue was closed without being merged. Opentriaged
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
挽「发」 -> 挽「發」May be free again A pull request for this issue was closed without being merged. Opentriaged
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/DirectXShaderCompiler#9173 ·
Maintainers usually reply within 2 days
-
feature:config kind:docs os:windows toolchain:cmake triaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
arch-based bug niri
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
noctalia-dev/noctalia#5552 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 5 days