How to use the emot.emo_unicode function in emot

To help you get started, we’ve selected a few emot 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 NeelShah18 / emot / emot / core.py View on Github external
def emoji(string):
    '''emot.emoji is use to detect emoji from text

        >>> text = "I love python 👨 :-)"
        >>> emot.emoji(text)
        >>> {'value': ['👨'], 'mean': [':man:'], 'location': [[14, 14]], 'flag': True}
    '''
    __entities = {}
    __value = []
    __mean = []
    __location = []
    flag = True
    try:
        pro_string = str(string)
        for pos,ej in enumerate(pro_string):
            if ej in emo_unicode.UNICODE_EMO:
                try:
                    __value.append(ej)
                    __mean.append(emo_unicode.UNICODE_EMO[ej])
                    __location.append([pos,pos])
                except Exception as e:
                    flag = False
                    __entities.append({"flag": False})
                    return __entities

    except Exception as e:
        flag = False
        __entities.append({"flag": False})
        return __entities
    if len(__value) < 1:
        flag = False    
    __entities = {

emot

Emoji and Emoticons detection package for Python

MIT
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis