Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def emoticons(string):
'''emot.emoticons is use to detect emoticons from text
>>> text = "I love python 👨 :-)"
>>> emot.emoticons(text)
>>> {'value': [':-)'], 'location': [[16, 19]], 'mean': ['Happy face smiley'], 'flag': True}
'''
__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,