def _clear_transcript(cls, transcript): cleaned_transcript = '' for word in transcript.split(): if word.isdigit() or word in math_symbols_mapping.values(): cleaned_transcript += word else: cleaned_transcript += math_symbols_mapping.get(word, '') return cleaned_transcript
def _replace_math_symbols_with_words(self, transcript): replaced_transcript = '' for word in transcript.split(): if word in math_symbols_mapping.values(): for key, value in math_symbols_mapping.items(): if value == word: replaced_transcript += ' ' + key else: replaced_transcript += ' ' + word return replaced_transcript
def _clear_transcript(cls, transcript): """ Keep in transcript only numbers and operators """ cleaned_transcript = '' for word in transcript.split(): if word.isdigit() or word in math_symbols_mapping.values(): # Add numbers cleaned_transcript += word else: # Add operators cleaned_transcript += math_symbols_mapping.get(word, '') return cleaned_transcript