Dataset Viewer
Auto-converted to Parquet Duplicate
emoji
stringlengths
1
9
message
stringlengths
2
78
embed
listlengths
1.02k
1.02k
🥇
1st place medal
[ -0.704297661781311, 0.40987685322761536, -0.4062398374080658, -0.1345590502023697, -0.29758113622665405, 0.22383224964141846, 0.5407073497772217, 0.2726382911205292, -0.5408409237861633, 0.2327812910079956, -0.05703119561076164, 0.13113243877887726, 0.2148643434047699, 1.0684181451797485, ...
🥈
2nd place medal
[ -0.8834242224693298, 0.4145815372467041, -0.521038830280304, 0.03661016374826431, -0.006369549315422773, 0.4214893877506256, 0.7781873345375061, -0.010371464304625988, -0.5542740225791931, 0.30471742153167725, -0.27157294750213623, -0.34638532996177673, -0.03589685633778572, 1.235480785369...
🥉
3rd place medal
[ -0.8940513730049133, 0.4233047068119049, -1.100096344947815, -0.2909272313117981, -0.22327445447444916, 0.21365715563297272, 0.4017561674118042, -0.10902874171733856, -0.5524333119392395, 0.46959203481674194, -0.11379256099462509, 0.03156298026442528, -0.10669548809528351, 1.80329871177673...
🆎
ab button (blood type)
[ -0.7239956259727478, -1.4498651027679443, 0.1775781512260437, 0.7205989956855774, -0.07122970372438431, -0.03753669559955597, -0.25557973980903625, 0.4229443669319153, -0.24291400611400604, 0.016070576384663582, 0.0711498111486435, -0.3356047570705414, -0.06441650539636612, -0.694954752922...
🏧
automated teller machine
[ -0.3480696380138397, -1.0431667566299438, -0.539194643497467, 0.5734949111938477, -0.44158005714416504, 0.002209685742855072, -0.665137767791748, -0.4125506281852722, -0.3273940682411194, -0.730308473110199, 0.8334714770317078, 0.08097242563962936, 0.04088886082172394, -1.1358882188796997,...
🅰️
a button (blood type)
[ -0.8563571572303772, -1.289086937904358, -0.9189965128898621, 0.6111841201782227, 0.23690998554229736, 0.276188462972641, -0.41677242517471313, 0.3484211564064026, -0.2826225459575653, 0.05309310927987099, -0.5174945592880249, -0.24605704843997955, 0.2057534158229828, -0.8071616291999817, ...
🅰
negative squared latin capital letter a
[ -0.2845832109451294, -0.6433258056640625, 0.23718950152397156, 0.009923148900270462, -0.160145103931427, 0.07552975416183472, -0.08077347278594971, 0.425550252199173, -0.21018315851688385, 0.5893181562423706, 0.6924072504043579, -0.15626317262649536, 0.014993338845670223, -0.44413188099861...
🇦🇫
flag for afghanistan
[ -0.3744734823703766, 0.05360185727477074, 1.24661123752594, 0.3676920235157013, 0.6496822834014893, -0.47808733582496643, -0.8976534605026245, 0.09904976189136505, -0.24190472066402435, 0.4425235688686371, 1.209485650062561, 0.11849243193864822, -0.015062447637319565, -0.27376699447631836,...
🇦🇱
flag for albania
[ -0.5504882335662842, -0.2514055669307709, 0.4472554922103882, -0.26004713773727417, 0.9586830139160156, -0.33237898349761963, -0.7730347514152527, 0.5362007021903992, 0.2662676274776459, 0.5422874689102173, 1.6474997997283936, 0.3745267689228058, 0.3431839048862457, 0.19799119234085083, ...
🇩🇿
flag for algeria
[-0.5171316862106323,0.016471445560455322,1.1334940195083618,-0.6998956203460693,0.7440917491912842,(...TRUNCATED)
End of preview. Expand in Data Studio

local emoji semantic search

Emoji, their text descriptions and precomputed text embeddings with Alibaba-NLP/gte-large-en-v1.5 for use in emoji semantic search.

This work is largely inspired by the original emoji-semantic-search repo and aims to provide the data for fully local use, as the demo is not working as of a few days ago.

  • This repo only contains a precomputed embedding "database", equivalent to server/emoji-embeddings.jsonl.gz in the original repo, to be used as the database for semantic search,
    • If working with the original repo, the inference class also needs to be updated to use SentenceTransformers instead of OpenAI calls (see below example)
  • The provided inference code is almost instant even on CPU 🔥

basic inference example

since the dataset is tiny, just load with pandas:

import pandas as pd

df = pd.read_parquet("hf://datasets/pszemraj/local-emoji-search-gte/data/train-00000-of-00001.parquet")
print(df.info())

load the sentence-transformers model:

# Requires sentence_transformers>=2.7.0

from sentence_transformers import SentenceTransformer

model = SentenceTransformer('Alibaba-NLP/gte-large-en-v1.5', trust_remote_code=True)

define a minimal semantic search inference function:

Click me to expand the inference function code
import numpy as np
import pandas as pd
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import semantic_search


def get_top_emojis(
    query: str,
    emoji_df: pd.DataFrame,
    model,
    top_k: int = 5,
    num_digits: int = 4,
) -> list:
    """
    Performs semantic search to find the most relevant emojis for a given query.

    Args:
        query (str): The search query.
        emoji_df (pd.DataFrame): DataFrame containing emoji metadata and embeddings.
        model (SentenceTransformer): The sentence transformer model for encoding.
        top_k (int): Number of top results to return.
        num_digits (int): Number of digits to round scores to

    Returns:
        list: A list of dicts, where each dict represents a top match. Each dict has keys 'emoji', 'message', and 'score'
    """
    query_embed = model.encode(query)
    embeddings_array = np.vstack(emoji_df.embed.values, dtype=np.float32)

    hits = semantic_search(query_embed, embeddings_array, top_k=top_k)[0]

    # Extract the top hits + metadata
    results = [
        {
            "emoji": emoji_df.loc[hit["corpus_id"], "emoji"],
            "message": emoji_df.loc[hit["corpus_id"], "message"],
            "score": round(hit["score"], num_digits),
        }
        for hit in hits
    ]
    return results

run inference!

import pprint as pp

query_text = "that is flames"
top_emojis = get_top_emojis(query_text, df, model, top_k=5)

pp.pprint(top_emojis, indent=2)

# [ {'emoji': '❤\u200d🔥', 'message': 'heart on fire', 'score': 0.7043},
#   {'emoji': '🥵', 'message': 'hot face', 'score': 0.694},
#   {'emoji': '😳', 'message': 'flushed face', 'score': 0.6794},
#   {'emoji': '🔥', 'message': 'fire', 'score': 0.6744},
#   {'emoji': '🧨', 'message': 'firecracker', 'score': 0.663}]
Downloads last month
19