Jaume commited on
Commit
69383c7
·
1 Parent(s): 93a4a65

handle missing field

Browse files
Files changed (1) hide show
  1. review.py +2 -0
review.py CHANGED
@@ -95,6 +95,8 @@ def apply_review(text: str, review: list[dict]) -> str:
95
  start = starts[0]
96
  end = start + len(entity["term"])
97
  output += text[last_end:start]
 
 
98
  if len(entity["fix"]) > 0:
99
  output += get_file("templates/correction.html").format(
100
  term=text[start:end], fix=entity["fix"], kind=entity["type"]
 
95
  start = starts[0]
96
  end = start + len(entity["term"])
97
  output += text[last_end:start]
98
+ if "fix" not in entity:
99
+ entity["fix"] = ""
100
  if len(entity["fix"]) > 0:
101
  output += get_file("templates/correction.html").format(
102
  term=text[start:end], fix=entity["fix"], kind=entity["type"]