NLPV commited on
Commit
3ada721
·
verified ·
1 Parent(s): 5db928f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -5,6 +5,7 @@ import difflib
5
  import pandas as pd
6
  from Levenshtein import distance as lev_distance
7
  import whisper
 
8
 
9
  # Load Whisper model once (choose "small" or "medium" for better results)
10
  #model = whisper.load_model("small")
@@ -30,6 +31,8 @@ def get_error_type(asr_word, correct_word):
30
 
31
  def compare_hindi_sentences(expected, transcribed):
32
  expected_words = expected.strip().split()
 
 
33
  transcribed_words = transcribed.strip().split()
34
  matcher = difflib.SequenceMatcher(None, transcribed_words, expected_words)
35
  errors = []
 
5
  import pandas as pd
6
  from Levenshtein import distance as lev_distance
7
  import whisper
8
+ import string
9
 
10
  # Load Whisper model once (choose "small" or "medium" for better results)
11
  #model = whisper.load_model("small")
 
31
 
32
  def compare_hindi_sentences(expected, transcribed):
33
  expected_words = expected.strip().split()
34
+ expected_clean = expected.translate(str.maketrans('', '', string.punctuation))
35
+ expected_words = expected_clean.strip().split()
36
  transcribed_words = transcribed.strip().split()
37
  matcher = difflib.SequenceMatcher(None, transcribed_words, expected_words)
38
  errors = []