Skip to main content

word2emoji

This simple module exposes one method to convert a single, english word to an emoji:

import word2emoji

print(word2emoji("beer"))

>>> 🍺

It works by way of a simple lookup table. You could use a pretrained model, but given that there are only a limited set of words in English it doesn't seem worth it. To build the look up table you need to run a number of steps:

Create the training set

The training.txt file contains a simple set to train on. test_to_training.py will convert it to training_prepared.jsonl which can be consumed by openai. Before you can get started, set your OPENAI_KEY:

export export OPENAI_API_KEY="sk-urshouldgohere"

You can then train fine tune the model. I use davinci:

openai api fine_tunes.create -t training_prepared.jsonl -m davinci

This will take a few minutes (it does require the )

Creating the lookup table

Now you are ready to create the lookup. This is done using

python create_db.py

Update the name of the model there if you want to use your own and delete/update words.json - this contains a dictionary from word-stem to (word, emoji) pair.

Once you are happy with your new db, you can run:

python flatten_db.py

Metadata

Release files for word2emoji 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for word2emoji 0.1.5
File Size Uploaded Provenance
word2emoji-0.1.5.tar.gz 661.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for word2emoji 0.1.5
File Interpreter ABI Platform
word2emoji-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / word2emoji-0.1.5.tar.gz

Download URL word2emoji-0.1.5.tar.gz
Size 661.1 kB
Tags Source
SHA-256 checksum
How to use checksums
957fe8acba3dbc8bf52a4abbd8a2ca23f397d6125f195b410f0d04498e53775b
BLAKE2b-256 checksum
How to use checksums
91488cc317e4c9801e120bd36a979178990f25994e0e91f9229f1b0651052436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.8

Release files / word2emoji-0.1.5-py3-none-any.whl

Download URL word2emoji-0.1.5-py3-none-any.whl
Size 662.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
271542e374d610df39025ed78114221b562c39ddd91ffec5dd90cb4385ead92b
BLAKE2b-256 checksum
How to use checksums
9b00dcfd636b3079f32e5efde52b032a823324466d06fe3a7a54bd3458aa4860
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.8

Security for word2emoji 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page