From 499b3634b3b1fd18cc22310c691f59978eca654d Mon Sep 17 00:00:00 2001 From: Lukhnos Liu Date: Sun, 2 Feb 2025 13:51:48 -0500 Subject: [PATCH] Remove redundant validation logic `bpmf_phrases` is guaranteed to have entries from `bpmf_chars`, and so we only need to validate data when reading from `PhraseFreq.txt`. --- Source/Data/bin/cook.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/Data/bin/cook.py b/Source/Data/bin/cook.py index 4e418518..d0d9b427 100755 --- a/Source/Data/bin/cook.py +++ b/Source/Data/bin/cook.py @@ -144,12 +144,8 @@ phrases[mykey] = myvalue for (mykey, myvalue) in phrases.items(): - try: - readings = bpmf_phrases[mykey] - except: - sys.exit('[ERROR] %s key mismatches.' % mykey) + readings = bpmf_phrases.get(mykey) - # print mykey if readings: # 剛好一個中文字字的長度目前還是 3 (標點、聲調好像都是2) if len(mykey) > 3: