Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _strip_emoticons(text):
global UNCOMMON_EMOTICONS
tokens = tweet_tokenize(text)
emoticons = set()
for token in tokens:
for em in emot.emoticons(token):
emoticon = em['value']
if emoticon in ('(', ')', ':') or emoticon != token:
continue
emoticons.add(emoticon)
if Emoticon_RE.match(token) or token in (':*(',):
emoticons.add(token)
for em in UNCOMMON_EMOTICONS:
if em in text:
emoticons.add(em)
normalized = text
for emoticon in emoticons:
if re.match(r'^[a-zA-Z0-9]+$', emoticon.lower()):
continue