Skip to main content

A build-time generated emoji lexicon for Python

Project description

emoji-lexicon

Tests coverage PyPI version Python License

🚀 emoji-lexicon is a fast, build-time generated emoji lexicon for Python, powered by Unicode emoji-test and CLDR annotations.

Features

  • Fast emoji lookup by short name, alias, or tag
  • Designed for CLI, IME, and dictionary tools
  • Unicode / CLDR based canonical data
  • Build-time normalization, runtime zero-cost lookup
  • Optional gemoji-compatible export

Requirements

  • Python 3.12+

Status

  • Stable build-time generation pipeline
  • ~98% test coverage
  • Deterministic emoji catalog generation
  • Public API is stable

Development

Emoji data is generated at build time from:

  • Unicode emoji-test.txt
  • CLDR annotations (English)

The runtime catalog is fully read-only and cached.

Installation

pip install emoji-lexicon

Usage

Basic usage:

from emoji_lexicon import get_catalog

catalog = get_catalog()

.get(), get_by_char(), get_all()

# lookup by short name or alias
catalog.get("smile")
# -> Emoji | None

# Slack / gemoji style
catalog.get(":smile:")

# lookup by emoji character
catalog.get_by_char("😁")
# -> Emoji | None

# get all emojis
catalog.get_all()

.search() , .find()

# partial match (short_name / alias / tag)
catalog.search("happy")
# -> tuple[Emoji, ...]

# alias of .search()
catalog.find("happy")
# -> tuple[Emoji, ...]

.search() and .find() perform partial matching and return multiple emojis. .find() is a user-facing alias of .search().

.groups(), .subgroups()

from emoji_lexicon import get_catalog
catalog = get_catalog()

# available emoji groups
catalog.groups()

# available emoji subgroups
catalog.subgroups()

Misc

# total emoji count
len(catalog)

# iterator
for emoji in catalog:
	print(emoji.char, emoji.short_name)

Application examples:

  • Categories UI
  • IME candidate narrowing down
  • emoji picker

Search behavior

The .search() and .find() methods perform token-based emoji search.

Search rules:

  • Case-insensitive
  • Supports Slack / gemoji style queries (e.g. :smile)
  • Space-separated tokens are combined using AND logic
  • Results are ranked by relevance

Matching priority (high -> low):

  1. Exact short name match
  2. Exact alias match
  3. Exact tag match
  4. Prefix match (only for tokens with 3+ characters)

Ranking is deterministic and stable (score-based, then emoji ID)

Example:

catalog.search("smile")
catalog.search("smile face")
catalog.search(":smile:")

Notes:

  • Prefix matching is disabled for very short tokens to reduce noise.
  • Result order is deterministic and stable.

Design philosophy

  • zero-cost at runtime
  • immutable catalog
  • Pythonic & typed

License

MIT License © 2026 Kiminori Kato

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emoji_lexicon-0.2.0.tar.gz (207.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emoji_lexicon-0.2.0-py3-none-any.whl (91.6 kB view details)

Uploaded Python 3

File details

Details for the file emoji_lexicon-0.2.0.tar.gz.

File metadata

  • Download URL: emoji_lexicon-0.2.0.tar.gz
  • Upload date:
  • Size: 207.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for emoji_lexicon-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ce90378f89fcba20874bfb94fff0720920a400ce5691e4198fda047d49d9fa0a
MD5 6de32b5351d15f659c25f80ca5ce0807
BLAKE2b-256 84d980274449438ba7b5edcd0f6558d662709ebffa3b4460b83ea139fdf0396d

See more details on using hashes here.

Provenance

The following attestation bundles were made for emoji_lexicon-0.2.0.tar.gz:

Publisher: release.yml on kimikato/emoji-lexicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file emoji_lexicon-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: emoji_lexicon-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 91.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for emoji_lexicon-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2335c58c55e9e86e2d565588bc1cdac6fcb192224977470f74cc2020baa1e43d
MD5 f5e4bb8bdb289131d7a0c29e572839e3
BLAKE2b-256 18b33ae0cd1985cec27aa9dd99e5992153e9a6536fc833ac2b25097d39e4fc08

See more details on using hashes here.

Provenance

The following attestation bundles were made for emoji_lexicon-0.2.0-py3-none-any.whl:

Publisher: release.yml on kimikato/emoji-lexicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page