Emot: Emoji and Emoticon Detection

3.1 · active · verified Thu Apr 16

Emot is a Python library designed for high-performance detection and extraction of emojis and emoticons from text, particularly useful for large-scale datasets. It utilizes advanced dynamic pattern generation based on an internal database. The current version, 3.1, released in August 2021, focuses on performance and bulk processing capabilities. The library provides details like the value, meaning, location, and presence (flag) of detected symbols.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the `emot` object and then use its `emoji()` or `emoticons()` methods to detect and extract symbols from a given string. The methods return a dictionary containing lists for 'value', 'location', 'mean', and a 'flag' indicating presence.

import emot

# Initialize the emot object (required since v3.0)
emot_obj = emot.core.emot()

text_with_emojis = "I love python 👨 🙂 ❤️"
text_with_emoticons = "Hello there :-) :D"
text_without_emotions = "No emotions here."

# Detect emojis
result_emoji = emot_obj.emoji(text_with_emojis)
print("Emoji detection:", result_emoji)
# Expected output for v3.1: {'value': ['👨', '🙂', '❤'], 'location': [[14, 15], [16, 17], [18, 19]], 'mean': [':man:', ':slightly_smiling_face:', ':red_heart:'], 'flag': True}

# Detect emoticons
result_emoticon = emot_obj.emoticons(text_with_emoticons)
print("Emoticon detection:", result_emoticon)
# Expected output for v3.1: {'value': [':-)', ':D'], 'location': [[12, 15], [16, 18]], 'mean': ['Happy face smiley', 'Grinning face'], 'flag': True}

# Handle text without emotions
result_none = emot_obj.emoji(text_without_emotions)
print("No emotions detection:", result_none)
# Expected output for v3.1: {'value': [], 'location': [], 'mean': [], 'flag': False}

view raw JSON →