-
Notifications
You must be signed in to change notification settings - Fork 94
Add new entries for '𰻝', '𰻞', and '𰻞𰻞麵' in BPMFBase.txt and phrase.occ #853
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cd2c344
Add new entries for '𰻝', '𰻞', and '𰻞𰻞麵' in BPMFBase.txt and phrase.occ
zonble 71a4906
Update CI workflows to install gawk and modify check command for UTF-…
zonble 2166bd1
Refactor CI workflows: remove gawk installation and update check comm…
zonble f3c63ca
Remove entries for '𰻝' and '𰻞' from BPMFMappings.txt
zonble 8ba6fa9
Refactor data validation checks in check.py to collect issues instead…
zonble File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144962,3 +144962,4 @@ | |
| 龜鑑 ㄍㄨㄟ ㄐㄧㄢˋ | ||
| 龜頭 ㄍㄨㄟ ㄊㄡˊ | ||
| 龜鱉目 ㄍㄨㄟ ㄅㄧㄝ ㄇㄨˋ | ||
| 𰻞𰻞麵 ㄅㄧㄤˊ ㄅㄧㄤˊ ㄇㄧㄢˋ | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152591,3 +152591,6 @@ | |
| 嗀 0 | ||
| 𡻈 0 | ||
| 𢻯 0 | ||
| 𰻝 0 | ||
| 𰻞 0 | ||
| 𰻞𰻞麵 0 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| def check_if_bpmf_mappings_matches(): | ||
| issues = [] | ||
| with open("BPMFMappings.txt", encoding="utf-8") as f: | ||
| for line in f: | ||
| components = line.strip().split(" ") | ||
| first = components[0] | ||
| if len(first) != len(components) - 1: | ||
| issues.append(f"Length mismatch: {line.strip()}") | ||
| return issues | ||
|
|
||
| def check_if_readings_in_bpmf_mappings_contains_non_bpmf(): | ||
| issues = [] | ||
| bpmf = ( | ||
| "ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦㄧㄨㄩˊˇˋ˙" | ||
| ) | ||
| with open("BPMFMappings.txt", encoding="utf-8") as f: | ||
| for line in f: | ||
| components = line.strip().split()[1:] | ||
| for c in components: | ||
| if any(char not in bpmf for char in c): | ||
| issues.append(f"Non bpmf {c} in {line.strip()}") | ||
| break | ||
| return issues | ||
|
|
||
| def compare_bpmf_mappings_with_phrase_occ(): | ||
| issues = [] | ||
| bpmf_mappings_phrases = set() | ||
| phrase_occ_phrases = set() | ||
| with open("BPMFMappings.txt", encoding="utf-8") as f: | ||
| for line in f: | ||
| components = line.strip().split(" ") | ||
| first = components[0] | ||
| if len(first) > 1: | ||
| bpmf_mappings_phrases.add(first) | ||
| with open("phrase.occ", encoding="utf-8") as f: | ||
| for line in f: | ||
| components = line.strip().split(" ") | ||
| first = components[0] | ||
| if len(first) > 1: | ||
| phrase_occ_phrases.add(first) | ||
| missing_in_phrase_occ = bpmf_mappings_phrases - phrase_occ_phrases | ||
| missing_in_bpmf_mappings = phrase_occ_phrases - bpmf_mappings_phrases | ||
| if missing_in_phrase_occ: | ||
| issues.append(f"Missing in phrase.occ: {missing_in_phrase_occ}") | ||
| if missing_in_bpmf_mappings: | ||
| issues.append(f"Missing in BPMFMappings.txt: {missing_in_bpmf_mappings}") | ||
| return issues | ||
|
|
||
|
|
||
| def main(): | ||
| all_issues = [] | ||
| all_issues.extend(check_if_bpmf_mappings_matches()) | ||
| all_issues.extend(check_if_readings_in_bpmf_mappings_contains_non_bpmf()) | ||
| all_issues.extend(compare_bpmf_mappings_with_phrase_occ()) | ||
|
|
||
| for issue in all_issues: | ||
| print(issue) | ||
|
|
||
| if all_issues: | ||
| raise RuntimeError(f"Data check failed with {len(all_issues)} issue(s).") | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if
check.pyfinds anything incorrect, does it end the program with a non-0 exit code?