How to use the emoji.emoji_count function in emoji

To help you get started, we’ve selected a few emoji examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyThaiNLP / pythainlp / pythainlp / ulmfit / __init__.py View on Github external
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
github PyThaiNLP / pythainlp / pythainlp / ulmfit / rules.py View on Github external
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
github PyThaiNLP / pythainlp / pythainlp / ulmfit / preprocess.py View on Github external
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