shrey2026 commited on
Commit
a50a6f5
·
verified ·
1 Parent(s): fbb41e9

Update nlp_utils.py

Browse files
Files changed (1) hide show
  1. nlp_utils.py +3 -3
nlp_utils.py CHANGED
@@ -39,11 +39,11 @@ def post_process_translation(mal_text, glossary_df):
39
  sorted_df = glossary_df.sort_values('match_len', ascending=False)
40
 
41
  for _, row in sorted_df.iterrows():
42
- eng_phrase = str(row['English_Term']).strip()
43
  mal_phrase = str(row['Malayalam_Translation']).strip()
44
 
45
- pattern = re.compile(re.escape(error_phrase), re.IGNORECASE)
46
- mal_text = pattern.sub(correct_phrase, mal_text)
47
 
48
  # 3. Clean 'Management Management' bug
49
  mal_text = re.sub(r'(\b\w+\b)( \1)+', r'\1', mal_text)
 
39
  sorted_df = glossary_df.sort_values('match_len', ascending=False)
40
 
41
  for _, row in sorted_df.iterrows():
42
+ eng_phrase = str(row['English_Term']).strip() # This is the variable name
43
  mal_phrase = str(row['Malayalam_Translation']).strip()
44
 
45
+ pattern = re.compile(re.escape(eng_phrase), re.IGNORECASE)
46
+ mal_text = pattern.sub(mal_phrase, mal_text)
47
 
48
  # 3. Clean 'Management Management' bug
49
  mal_text = re.sub(r'(\b\w+\b)( \1)+', r'\1', mal_text)