Metadata-Version: 2.1
Name: word2emoji
Version: 0.1.4
Summary: Convert any word in the English language to an emoji
Author-email: Douwe Osinga <douwe.osinga@gmail.com>
License: MIT License        
        Copyright (c) 2022 Douwe Osinga        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.        
Project-URL: Documentation, https://github.com/DOsinga/word2emoji#readme
Project-URL: Issues, https://github.com/DOsinga/word2emoji/issues
Project-URL: Source, https://github.com/DOsinga/word2emoji
Keywords: emoji,nlp,text
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nltk

# word2emoji

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

    import word2emoji

    print(word2emoji.lookup("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



