AWS Lambda Event Handler
transcribe.lambda_function
classify_mispronunciation(results, ground_truth, language)
Classifies if a transcription result and ground truth text is a case of mispronunciation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results |
Dict[str, List]
|
Resultant output received from AWS Transcribe. |
required |
ground_truth |
str
|
Ground truth text for the corresponding annotation. |
required |
language |
str
|
Language of the transcript-ground truth pair. |
required |
Returns:
Name | Type | Description |
---|---|---|
Mispronunciation |
Mispronunciation
|
Object of mispronunciation present. |
Source code in src/transcribe/lambda_function.py
get_ground_truth(ground_truth_filename_prefix)
Attempts to grab ground truth file from S3, either ending in txt or srt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ground_truth_filename_prefix |
str
|
Prefix of ground truth file name. |
required |
Returns:
Type | Description |
---|---|
Tuple[str, str]
|
Tuple[str, str]: Pair of [ground truth string, ground truth file extension],
otherwise |
Source code in src/transcribe/lambda_function.py
get_language_code(filename)
Get language code from filename for transcribing
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
Audio filename with complete S3 path. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Language code of the audio file, formatted for AWS Transcribe. |
Source code in src/transcribe/lambda_function.py
lambda_handler(event, context)
Event listener for S3 event and calls Transcribe job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
AWS Event
|
A JSON-formatted document that contains data for a Lambda function to process. |
required |
context |
AWS Context
|
An object that provides methods and properties that provide information about the invocation, function, and runtime environment. |
required |
Source code in src/transcribe/lambda_function.py
main(audio_file)
Main function to run Transcribe, generate Label Studio JSON-annotation, and saves JSON to S3.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
audio_file |
str
|
Audio filename with complete S3 path. |
required |
Source code in src/transcribe/lambda_function.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|