@@ -117,37 +117,33 @@ def map_to_hindi(self, transcript: str) -> str:
117
117
]
118
118
return ' ' .join (translated_words )
119
119
120
- def modify_utterances (self , utterances : List [List [ Dict [ str , str ]]] ) -> List [List [ Dict [ str , str ]] ]:
120
+ def modify_transcripts (self , transcripts : List [str ] ) -> List [str ]:
121
121
"""
122
- Modifies utterances by transliterating date/time words.
122
+ Modifies transcripts by transliterating date/time words.
123
123
124
124
Args:
125
- utterances : List of ASR transcripts with confidence scores
125
+ transcripts : List of transcripts to process
126
126
127
127
Returns:
128
- Modified utterances with transliterated text
128
+ Modified transcripts with transliterated text
129
129
"""
130
- if not utterances or not utterances [ 0 ] :
131
- return utterances
130
+ if not transcripts :
131
+ return transcripts
132
132
133
- for transcript in utterances [0 ]:
134
- if 'transcript' in transcript :
135
- transcript ['transcript' ] = self .map_to_hindi (transcript ['transcript' ])
136
-
137
- return utterances
133
+ return [self .map_to_hindi (transcript ) for transcript in transcripts ]
138
134
139
135
async def utility (self , input_ : Input , output : Output ) -> Any :
140
136
"""
141
- Plugin utility method that processes the input utterances .
137
+ Plugin utility method that processes the input transcripts .
142
138
143
139
Args:
144
- input_: Input object containing utterances
140
+ input_: Input object containing transcripts
145
141
output: Output object for results
146
142
147
143
Returns:
148
- Modified utterances with transliterated text
144
+ Modified transcripts with transliterated text
149
145
"""
150
- logger .debug (f"Input utterances for transliteration:\n { input_ .utterances } " )
151
- modified_utterances = self .modify_utterances (input_ .utterances )
152
- logger .debug (f"Transliterated utterances :\n { modified_utterances } " )
153
- return modified_utterances
146
+ logger .debug (f"Input transcripts for transliteration:\n { input_ .transcripts } " )
147
+ modified_transcripts = self .modify_transcripts (input_ .transcripts )
148
+ logger .debug (f"Transliterated transcripts :\n { modified_transcripts } " )
149
+ return modified_transcripts
0 commit comments