https://github.com/zhouy185/emoji_mapping/blob/main/emoji_map.ipynb
In this exercise, you will build a simple emoji translator in Python. The goal is to replace certain emotion adjectives (like happy, sad, angry) with matching emojis.
You are given a dictionary of words mapped to emojis:
EMOJI_MAP = {
"happy": "๐",
"joyful": "๐",
"excited": "๐คฉ",
"proud": "๐",
"calm": "๐",
"confident": "๐",
"playful": "๐",
"silly": "๐คช",
"angry": "๐ก",
"frustrated": "๐ค",
"sad": "๐ข",
"lonely": "๐ฅบ",
"scared": "๐ฑ",
"worried": "๐",
"tired": "๐ด",
"confused": "๐ค",
"surprised": "๐ฎ",
"loving": "โค๏ธ",
"grateful": "๐"
}
Write Python codes in emoji_map.ipynb to:
-
Splits the input text into words.
-
Replaces words found in EMOJI_MAP with their emoji.
-
Keeps all other words unchanged.
For example, "I am happy but also tired" will be converted to "I am ๐ but also ๐ด"
- Make sure you have a GitHub account (sign up with your McMaster email at https://github.com/join).
- Accept the assignment link provided in GitHub Classroom.
- A private repository will be created for you automatically.
- Go to your private assignment repository on GitHub.
- Click on
emoji_map.ipynb
. - Click the "Open in colab" badge. If not visible, then in the browserโs address bar, replace
https://github.com/
withhttps://colab.research.google.com/github/
- Press Enter โ your notebook opens in Colab.
- Edit the code cells in Colab.
- Run the cells to test your work.
- Changes are only in Colab until you save them back to GitHub.
- In Colab, click File โ Save a copy in GitHub.
- In the dialog:
- Repository: choose your private assignment repo (e.g.,
emoji_mapping-username
). - File path: keep it as
emoji_map.ipynb
. - Commit message: write something like
"Finished assignment"
or"Update notebook"
.
- Click OK.
- Your updated notebook is now saved to GitHub.