Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def ungroup_emoji(toks: Collection):
"Ungroup emojis"
res = []
for tok in toks:
if emoji.emoji_count(tok) == len(tok):
for char in tok:
res.append(char)
else:
res.append(tok)
return res
def ungroup_emoji(toks: Collection):
"""Ungroup emojis"""
res = []
for tok in toks:
if emoji.emoji_count(tok) == len(tok):
res.extend([char for char in tok])
else:
res.append(tok)
return res
def ungroup_emoji(toks: Collection[str]) -> List[str]:
"""
Ungroup Zero Width Joiner (ZVJ) Emojis
See https://emojipedia.org/emoji-zwj-sequence/
"""
res = []
for tok in toks:
if emoji.emoji_count(tok) == len(tok):
res.extend(list(tok))
else:
res.append(tok)
return res