akki2825 commited on
Commit
e3737ef
·
verified ·
1 Parent(s): 861de91

fix length issue

Browse files
Files changed (1) hide show
  1. app.py +3 -0
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] + '**'])