Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'''
__entities = []
flag = True
try:
pattern = u'(' + u'|'.join(k for k in emo_unicode.EMOTICONS) + u')'
__entities = []
__value = []
__location = []
matches = re.finditer(r"%s"%pattern,str(string))
for et in matches:
__value.append(et.group().strip())
__location.append([et.start(),et.end()])
__mean = []
for each in __value:
__mean.append(emo_unicode.EMOTICONS_EMO[each])
if len(__value) < 1:
flag = False
__entities = {
'value' : __value,
'location' : __location,
'mean' : __mean,
'flag' : flag
}
except Exception as e:
__entities = [{'flag' : False}]
#print("No emoiticons found")
return __entities
return __entities