File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11from app .root_logger import get_root_logger
22import math
33import traceback
4+ import string # to remove punctuation
45from typing import Optional , Callable
56
67from app .audio import Audio
@@ -60,13 +61,20 @@ def get_proportional_result(value: float,
6061 else :
6162 return f (upper_bound / value )
6263
63-
6464def get_fillers (fillers : list , audio : Audio ) -> list :
6565 found_fillers = []
66+ # пунктуация + пробелы для str.translate
67+ removable = string .punctuation + string .whitespace
68+ translation_table = str .maketrans ('' , '' , removable )
69+
6670 for audio_slide in audio .audio_slides :
6771 found_slide_fillers = []
72+ # добавлена предобработка слов - перевод в нижний регистр, очистка от пунктуации
6873 audio_slide_words = [
69- recognized_word .word .value for recognized_word in audio_slide .recognized_words ]
74+ recognized_word .word .value .lower ().translate (translation_table )
75+ for recognized_word in audio_slide .recognized_words
76+ ]
77+
7078 for i in range (len (audio_slide_words )):
7179 for filler in fillers :
7280 filler_split = filler .split ()
You can’t perform that action at this time.
0 commit comments