in src/process_transcription_full_text.py [0:0]
def parse_detected_key_phrases_response(detected_phrase_response):
if 'ErrorList' in detected_phrase_response and len(detected_phrase_response['ErrorList']) > 0:
logger.error("encountered error during batch_detect_key_phrases")
logger.error(json.dumps(detected_phrase_response['ErrorList'], indent=4))
if 'ResultList' in detected_phrase_response:
result_list = detected_phrase_response["ResultList"]
phrases_set = set()
for result in result_list:
phrases = result['KeyPhrases']
for detected_phrase in phrases:
if float(detected_phrase["Score"]) >= ENTITY_CONFIDENCE_THRESHOLD:
phrase = detected_phrase["Text"]
phrases_set.add(phrase)
key_phrases = list(phrases_set)
return key_phrases
else:
return []