演算法缺陷導致s2twp「正則表達式=>正規表示式」無作用

Open
#475 19 comments 0 reactions 0 assignees View on GitHub

A pull request for this has already been merged.

  • #1193 by @frankslin — merged

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
cpp
Domain
localization

Research direction

Start by tracing the s2twp conversion path and how STPhrases.ocd2 tokenizes text before applying TWPhrases* rules. Compare the handling of 「正则表达式」 with the intended 「正規表示式」 result. Done should mean the phrase-level rule works despite earlier tokenization, with relevant conversion behavior verified.

Written by the indexing model from the issue text.

Description

bug

如題,雖然 TWPhrases* 有定義「正則表達式=>正規表示式」,但實際使用會把「正则表达式」轉成「正則表示式」。

我看不太懂C的程式碼,但就目前s2twp的配置檔看起來,程式似乎是先根據 STPhrases.ocd2 分詞,然後再對分詞後的片段做簡繁轉換和地區字詞轉換。由於 STPhrases 已經有「表达式=>表達式」一詞,原文會被切成「正则 表达式」,之後簡轉繁成為「正則 表達式」,由於已被切開,因此TWPhrases* 定義的「正則表達式=>正規表示式」無法匹配。

演算法可能需要改進,否則只有在STPhrases加入「正则表达式=>正則表達式」才能解決此問題。

Dominant language
C++
Stars
10.1k
Forks
1.1k
Avg merge
47m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BYVoid/OpenCC

All issues in BYVoid/OpenCC

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.