Vadym Myroshnyk commited on
Commit ·
a9763ea
1
Parent(s): 7edeceb
save
Browse files- utils/comparator.py +2 -3
utils/comparator.py
CHANGED
|
@@ -21,7 +21,7 @@ def highlight_fuzzy_diff(user_text, original_text, threshold=92, max_position_sh
|
|
| 21 |
|
| 22 |
original_display_words = re.findall(r"\w+|[^\w\s]", original_text)
|
| 23 |
|
| 24 |
-
display_index = 0
|
| 25 |
|
| 26 |
for i, orig_word in enumerate(original_words):
|
| 27 |
best_score = 0
|
|
@@ -36,7 +36,6 @@ def highlight_fuzzy_diff(user_text, original_text, threshold=92, max_position_sh
|
|
| 36 |
best_score = score
|
| 37 |
best_index = j
|
| 38 |
|
| 39 |
-
# Виводимо слово в оригінальній формі (з комами, крапками)
|
| 40 |
while display_index < len(original_display_words):
|
| 41 |
display_candidate = original_display_words[display_index]
|
| 42 |
if re.match(r"\w+", display_candidate):
|
|
@@ -47,7 +46,7 @@ def highlight_fuzzy_diff(user_text, original_text, threshold=92, max_position_sh
|
|
| 47 |
highlighted.append(display_candidate)
|
| 48 |
display_index += 1
|
| 49 |
else:
|
| 50 |
-
display_word = orig_word
|
| 51 |
|
| 52 |
if best_score >= threshold and best_index != -1:
|
| 53 |
used_user_indices.add(best_index)
|
|
|
|
| 21 |
|
| 22 |
original_display_words = re.findall(r"\w+|[^\w\s]", original_text)
|
| 23 |
|
| 24 |
+
display_index = 0
|
| 25 |
|
| 26 |
for i, orig_word in enumerate(original_words):
|
| 27 |
best_score = 0
|
|
|
|
| 36 |
best_score = score
|
| 37 |
best_index = j
|
| 38 |
|
|
|
|
| 39 |
while display_index < len(original_display_words):
|
| 40 |
display_candidate = original_display_words[display_index]
|
| 41 |
if re.match(r"\w+", display_candidate):
|
|
|
|
| 46 |
highlighted.append(display_candidate)
|
| 47 |
display_index += 1
|
| 48 |
else:
|
| 49 |
+
display_word = orig_word
|
| 50 |
|
| 51 |
if best_score >= threshold and best_index != -1:
|
| 52 |
used_user_indices.add(best_index)
|