Spaces:
Sleeping
Sleeping
fix length issue
Browse files
app.py
CHANGED
|
@@ -101,6 +101,9 @@ def identify_misaligned_sentences(reference_text, hypothesis_text):
|
|
| 101 |
if ref_words[j] != hyp_words[j]:
|
| 102 |
misalignment_start = j
|
| 103 |
break
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
# Prepare the context for display
|
| 106 |
context_ref = ' '.join(ref_words[:misalignment_start] + ['**' + ref_words[misalignment_start] + '**'])
|
|
|
|
| 101 |
if ref_words[j] != hyp_words[j]:
|
| 102 |
misalignment_start = j
|
| 103 |
break
|
| 104 |
+
# Check if one sentence is longer than the other
|
| 105 |
+
if len(ref_words) != len(hyp_words):
|
| 106 |
+
misalignment_start = min_length
|
| 107 |
|
| 108 |
# Prepare the context for display
|
| 109 |
context_ref = ' '.join(ref_words[:misalignment_start] + ['**' + ref_words[misalignment_start] + '**'])
|