huckiyang commited on
Commit
74ae500
·
1 Parent(s): ca35170

two process

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -155,12 +155,15 @@ def transcribe_chinese(audio_file, chinese_variant="Traditional"):
155
  # Convert between simplified and traditional Chinese if needed
156
  if chinese_variant == "Traditional":
157
  # Convert simplified to traditional
158
- cc = OpenCC('s2twp') # s2twp: Simplified to Traditional (Taiwan standard with phrases)
 
 
 
159
  asr_text = cc.convert(asr_text)
160
  elif chinese_variant == "Simplified" and not asr_text.isascii():
161
  # If the text contains non-ASCII characters, it might be traditional
162
  # Convert traditional to simplified just to be safe
163
- cc = OpenCC('tw2sp') # tw2sp: Traditional (Taiwan standard) to Simplified with phrases
164
  asr_text = cc.convert(asr_text)
165
 
166
  return asr_text
 
155
  # Convert between simplified and traditional Chinese if needed
156
  if chinese_variant == "Traditional":
157
  # Convert simplified to traditional
158
+ # Use s2t for more complete conversion from Simplified to Traditional
159
+ cc = OpenCC('s2twp') # s2twp
160
+ asr_text = cc.convert(asr_text)
161
+ cc = OpenCC('s2t') # s2t
162
  asr_text = cc.convert(asr_text)
163
  elif chinese_variant == "Simplified" and not asr_text.isascii():
164
  # If the text contains non-ASCII characters, it might be traditional
165
  # Convert traditional to simplified just to be safe
166
+ cc = OpenCC('t2s') # t2s: Traditional to Simplified
167
  asr_text = cc.convert(asr_text)
168
 
169
  return asr_text