How to use the emoji.unicode_codes.EMOJI_UNICODE 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 carpedm20 / emoji / tests / test_unicode_codes.py View on Github external
def test_emoji_names():

    for name in emoji.unicode_codes.EMOJI_UNICODE.keys():
        assert name.startswith(':') and name.endswith(':') and len(name) >= 3
github carpedm20 / emoji / emoji / core.py View on Github external
def get_emoji_regexp():

    """Returns compiled regular expression that matches emojis defined in
    ``emoji.UNICODE_EMOJI_ALIAS``. The regular expression is only compiled once.
    """

    global _EMOJI_REGEXP
    # Build emoji regexp once
    if _EMOJI_REGEXP is None:
        # Sort emojis by length to make sure mulit-character emojis are
        # matched first
        emojis = sorted(unicode_codes.EMOJI_UNICODE.values(), key=len,
                        reverse=True)
        pattern = u'(' + u'|'.join(re.escape(u) for u in emojis) + u')'
        _EMOJI_REGEXP = re.compile(pattern)
    return _EMOJI_REGEXP
github lucasrodes / whatstk / whatstk / whatsapp / generation.py View on Github external
def _generate_emojis(self, k=1):
        """Generate random list of emojis.

        Emojis are sampled from a list of `n` emojis and `k*n` empty strings.

        Args:
            k (int, optional): Defaults to 20.

        Returns:
            list: List with emojis

        """
        emojis = list(EMOJI_UNICODE.values())
        n = len(emojis)
        emojis = emojis + [''] * k*n
        return np.random.choice(emojis, self.size)
github lucasrodes / whatstk / whatstk / utils / chat_generator.py View on Github external
def generate_emojis(self, k=1):
        """Generate random list of emojis.

        Emojis are sampled from a list of `n` emojis and `k*n` empty strings.

        Args:
            k (int, optional): Defaults to 20.

        Returns:
            list: List with emojis

        """
        emojis = list(EMOJI_UNICODE.values())
        n = len(emojis)
        emojis = emojis + [''] * k*n
        return np.random.choice(emojis, self.size)
github fadhluu / mocking-spongebob-bot / emoji_generator.py View on Github external
def __init__(self, sentence):
        self.sentence = sentence
        self.list_emoji = emoji.unicode_codes.EMOJI_UNICODE
        self.emoji = ''
github carpedm20 / emoji / emoji / core.py View on Github external
def replace(match):
        mg = match.group(1).replace(delimiters[0], _DEFAULT_DELIMITER).replace(delimiters[1], _DEFAULT_DELIMITER)
        if use_aliases:
            return unicode_codes.EMOJI_ALIAS_UNICODE.get(mg, mg)
        else:
            return unicode_codes.EMOJI_UNICODE.get(mg, mg)