in pca-server/src/pca/pca-aws-sf-process-turn-by-turn.py [0:0]
def __init__(self, min_sentiment_pos, min_sentiment_neg, custom_entity_endpoint):
self.min_sentiment_positive = min_sentiment_pos
self.min_sentiment_negative = min_sentiment_neg
self.transcribeJobInfo = ""
self.conversationLanguageCode = ""
self.comprehendLanguageCode = ""
self.guid = ""
self.agent = ""
self.conversationTime = ""
self.conversationLocation = ""
self.speechSegmentList = []
self.headerEntityDict = {}
self.numWordsParsed = 0
self.cummulativeWordAccuracy = 0.0
self.maxSpeakerIndex = 0
self.customEntityEndpointName = custom_entity_endpoint
self.customEntityEndpointARN = ""
self.simpleEntityMap = {}
self.matchedSimpleEntities = {}
self.audioPlaybackUri = ""
self.duration = 0.0
self.transcript_uri = ""
self.api_mode = cf.API_STANDARD
self.analytics_channel_map = {}
self.asr_output = ""
self.issues_detected = []
cf.loadConfiguration()
# Check the model exists - if now we may use simple file entity detection instead
if self.customEntityEndpointName != "":
# Get the ARN for our classifier endpoint, getting out quickly if there
# isn't one defined or if we can't find the one that is defined
comprehendClient = boto3.client("comprehend")
recognizerList = comprehendClient.list_endpoints()
recognizer = list(filter(lambda x: x["EndpointArn"].endswith(self.customEntityEndpointName),
recognizerList["EndpointPropertiesList"]))
# Only use it if it exists (!) and is IN_SERVICE
if (recognizer == []) or (recognizer[0]["Status"] != "IN_SERVICE"):
# Doesn't exist, so ignore the config
self.customEntityEndpointName = ""
else:
self.customEntityEndpointARN = recognizer[0]["EndpointArn"]
# Set flag to say if we could do simple entities
self.simpleEntityMatchingUsed = (self.customEntityEndpointARN == "") and \
(cf.appConfig[cf.CONF_ENTITY_FILE] != "")