Emaad commited on
Commit
c6eb060
1 Parent(s): f2dd671

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -13,16 +13,23 @@ def bold_predicted_letters(input_string: str, output_string: str) -> str:
13
  i = j = 0
14
  input_string = input_string.upper()
15
  output_string = output_string.upper()
 
16
  while i < len(input_string):
17
  if input_string[i:i+6] == "<MASK>":
18
- result.append("**" + output_string[j] + "**")
19
- i += 6
20
- j += 1
 
 
 
 
 
21
  else:
22
  result.append(input_string[i])
23
  i += 1
24
  if input_string[i-1] != "<":
25
  j += 1
 
26
  return "".join(result)
27
 
28
  class model:
 
13
  i = j = 0
14
  input_string = input_string.upper()
15
  output_string = output_string.upper()
16
+
17
  while i < len(input_string):
18
  if input_string[i:i+6] == "<MASK>":
19
+ start_index = i
20
+ end_index = i + 6
21
+ while end_index < len(input_string) and input_string[end_index:end_index+6] == "<MASK>":
22
+ end_index += 6
23
+
24
+ result.append("**" + output_string[j:j+(end_index-start_index)//6] + "**")
25
+ i = end_index
26
+ j += (end_index-start_index)//6
27
  else:
28
  result.append(input_string[i])
29
  i += 1
30
  if input_string[i-1] != "<":
31
  j += 1
32
+
33
  return "".join(result)
34
 
35
  class model: