Convert any word in the English language to an emoji
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file word2emoji-0.1.5.tar.gz.
File metadata
- Download URL: word2emoji-0.1.5.tar.gz
- Upload date:
- Size: 661.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
957fe8acba3dbc8bf52a4abbd8a2ca23f397d6125f195b410f0d04498e53775b
|
|
| MD5 |
8522c68255f12b3a3d9d237d1729091c
|
|
| BLAKE2b-256 |
91488cc317e4c9801e120bd36a979178990f25994e0e91f9229f1b0651052436
|
File details
Details for the file word2emoji-0.1.5-py3-none-any.whl.
File metadata
- Download URL: word2emoji-0.1.5-py3-none-any.whl
- Upload date:
- Size: 662.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
271542e374d610df39025ed78114221b562c39ddd91ffec5dd90cb4385ead92b
|
|
| MD5 |
3fcb0621ae6cb125f45756c7cee5373c
|
|
| BLAKE2b-256 |
9b00dcfd636b3079f32e5efde52b032a823324466d06fe3a7a54bd3458aa4860
|