forked from Gustaf-C/anki-chinese-support-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid
refromat_transcript()
on original pinyin
Before this change, there are two different ways that the code interacts with `pinyin` in a note: 1. If the `pinyin` field is empty, it uses the `hanzi` field as a source-of-truth to generate the `pinyin` field. 2. If the `pinyin` field is non-empty, it takes the contents of `pinyin` and runs `reformat_transcript()` on it. The idea of this function is that it will update (split, colorize, etc) the `pinyin` field with new information (that the user provides). This function does the splitting using a regular-expression. We have observed a bug in this logic that occurs for some words, such as 可能 which initially see the correct pinyin populated ("kě néng") but have this pinyin incorrectly change ("kěn éng") as a result of running the `reformat_transcript()` function on them. This bug can occur for any pinyin in which there are multiple acceptable regular expression splits. Bug report: Gustaf-C#55 This commit attempts to put a bandaid over the issue by avoiding repopulating the pinyin field for words if the user did not change the original hanzi transcription. Unit tests and documentation are also included in the commit.
- Loading branch information
1 parent
b638ce1
commit dc4e703
Showing
2 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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