Juna190825 commited on
Commit
85de656
·
verified ·
1 Parent(s): 18893af

Add removal for prefix3

Browse files

prefix3 = ['Zomi-in tei in, English ahih leh Zomi-in tei in: ']
This prefix3 occurs when input is English.

Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -38,6 +38,7 @@ def translate_zomi(text: str):
38
  # Remove prefix
39
  prefix = "Translate Zomi to English, if it is English translate it to Zomi: "
40
  prefix2 = "Zomi pan English in tei in, English ahih leh Zomi in tei in: "
 
41
  if output.startswith(prefix):
42
  output = output[len(prefix):].strip()
43
  # Remove surrounding quotes
@@ -49,6 +50,11 @@ def translate_zomi(text: str):
49
  # Remove surrounding quotes
50
  if (output.startswith('"') and output.endswith('"')) or (output.startswith("'") and output.endswith("'")):
51
  output = output[1:-1].strip()
 
 
 
 
 
52
 
53
  return output
54
 
 
38
  # Remove prefix
39
  prefix = "Translate Zomi to English, if it is English translate it to Zomi: "
40
  prefix2 = "Zomi pan English in tei in, English ahih leh Zomi in tei in: "
41
+ prefix3 = 'Zomi-in tei in, English ahih leh Zomi-in tei in: '
42
  if output.startswith(prefix):
43
  output = output[len(prefix):].strip()
44
  # Remove surrounding quotes
 
50
  # Remove surrounding quotes
51
  if (output.startswith('"') and output.endswith('"')) or (output.startswith("'") and output.endswith("'")):
52
  output = output[1:-1].strip()
53
+ elif output.startswith(prefix3):
54
+ output = output[len(prefix3):].strip()
55
+ # Remove surrounding quotes
56
+ if (output.startswith('"') and output.endswith('"')) or (output.startswith("'") and output.endswith("'")):
57
+ output = output[1:-1].strip()
58
 
59
  return output
60