-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created and Added all the languages that support Emoji #440
base: main
Are you sure you want to change the base?
Changes from all commits
c690e88
c7f20e4
c845d1b
43458e7
54f591b
736ebc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
""" | ||
Centralized keyword-emoji generation file to generated emoji for a specified Language | ||
.. raw:: html | ||
<!-- | ||
* Copyright (C) 2024 Scribe | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
--> | ||
""" | ||
|
||
import json | ||
from scribe_data.unicode.process_unicode import gen_emoji_lexicon | ||
from scribe_data.utils import export_formatted_data | ||
from pathlib import Path | ||
|
||
DATA_TYPE = "emoji-keywords" | ||
EMOJI_KEYWORDS_DICT = 3 | ||
|
||
SUPPORTED_LANGUAGE_FILE = Path(__file__).parent / "supported_languages.json" | ||
|
||
def generate_emoji(language, output_dir: str = None): | ||
print(f"Got the language {language} for emoji generation") | ||
|
||
# check if this language is supported | ||
with open(SUPPORTED_LANGUAGE_FILE, "r", encoding="utf-8") as file: | ||
languages = json.load(file) | ||
# Check if the language code exists in the dictionary | ||
for code, name in languages.items(): | ||
if name == language: | ||
print(f"Emoji Generation for language : {language} is supported") | ||
break | ||
else: | ||
print(f"Emoji Generation for language : {language} is not supported") | ||
return | ||
|
||
updated_path = output_dir[2:] if output_dir.startswith("./") else output_dir | ||
export_dir = Path(updated_path) / language.capitalize() | ||
export_dir.mkdir(parents=True, exist_ok=True) | ||
|
||
if emoji_keywords_dict := gen_emoji_lexicon( | ||
language=language, | ||
emojis_per_keyword=EMOJI_KEYWORDS_DICT, | ||
):export_formatted_data( | ||
file_path=output_dir, | ||
formatted_data=emoji_keywords_dict, | ||
query_data_in_use=True, | ||
language=language, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should use Then we can call |
||
data_type=DATA_TYPE, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
{ | ||
"am": "amharic", | ||
"ar": "arabic", | ||
"ar-SA": "arabic (saudi arabia)", | ||
"as": "assamese", | ||
"ast": "asturian", | ||
"az": "azerbaijani", | ||
"be": "belarusian", | ||
"bew": "betawi", | ||
"bg": "bulgarian", | ||
"bgn": "western balochi", | ||
"bn": "bengali", | ||
"br": "breton", | ||
"bs": "bosnian", | ||
"ca": "catalan", | ||
"ccp": "chakma", | ||
"ceb": "cebuano", | ||
"chr": "cherokee", | ||
"ckb": "sorani kurdish", | ||
"cs": "czech", | ||
"cv": "chuvash", | ||
"cy": "welsh", | ||
"da": "danish", | ||
"de": "german", | ||
"de-CH": "german (switzerland)", | ||
"doi": "dogri", | ||
"dsb": "lower sorbian", | ||
"el": "greek", | ||
"en": "english", | ||
"en-001": "english (world)", | ||
"en-AU": "english (australia)", | ||
"en-CA": "english (canada)", | ||
"en-GB": "english (united kingdom)", | ||
"en-IN": "english (india)", | ||
"es": "spanish", | ||
"es-419": "spanish (latin america)", | ||
"es-MX": "spanish (mexico)", | ||
"es-US": "spanish (united states)", | ||
"et": "estonian", | ||
"eu": "basque", | ||
"fa": "persian", | ||
"ff": "fulah", | ||
"ff-Adlm": "fulah (adlam)", | ||
"fi": "finnish", | ||
"fil": "filipino", | ||
"fo": "faroese", | ||
"fr": "french", | ||
"fr-CA": "french (canada)", | ||
"ga": "irish", | ||
"gd": "scottish gaelic", | ||
"gl": "galician", | ||
"gu": "gujarati", | ||
"ha": "hausa", | ||
"ha-NE": "hausa (niger)", | ||
"he": "hebrew", | ||
"hi": "hindi", | ||
"hi-Latn": "hindi (latin script)", | ||
"hr": "croatian", | ||
"hsb": "upper sorbian", | ||
"hu": "hungarian", | ||
"hy": "armenian", | ||
"ia": "interlingua", | ||
"id": "indonesian", | ||
"ig": "igbo", | ||
"is": "icelandic", | ||
"it": "italian", | ||
"ja": "japanese", | ||
"jv": "javanese", | ||
"ka": "georgian", | ||
"kab": "kabyle", | ||
"kk": "kazakh", | ||
"kl": "greenlandic", | ||
"km": "khmer", | ||
"kn": "kannada", | ||
"ko": "korean", | ||
"kok": "konkani", | ||
"ku": "kurdish", | ||
"ky": "kyrgyz", | ||
"lb": "luxembourgish", | ||
"lij": "ligurian", | ||
"lo": "lao", | ||
"lt": "lithuanian", | ||
"lv": "latvian", | ||
"mai": "maithili", | ||
"mi": "māori", | ||
"mk": "macedonian", | ||
"ml": "malayalam", | ||
"mn": "mongolian", | ||
"mni": "meitei", | ||
"mr": "marathi", | ||
"ms": "malay", | ||
"mt": "maltese", | ||
"my": "burmese", | ||
"ne": "nepali", | ||
"nl": "dutch", | ||
"nn": "norwegian nynorsk", | ||
"no": "norwegian", | ||
"nso": "northern sotho", | ||
"oc": "occitan", | ||
"or": "odia", | ||
"pa": "punjabi", | ||
"pa-Arab": "punjabi (arabic script)", | ||
"pcm": "nigerian pidgin", | ||
"pl": "polish", | ||
"ps": "pashto", | ||
"pt": "portuguese", | ||
"pt-PT": "portuguese (portugal)", | ||
"qu": "quechua", | ||
"quc": "k'iche'", | ||
"rhg": "rohingya", | ||
"rm": "romansh", | ||
"ro": "romanian", | ||
"ru": "russian", | ||
"rw": "kinyarwanda", | ||
"sa": "sanskrit", | ||
"sat": "santali", | ||
"sc": "sardinian", | ||
"sd": "sindhi", | ||
"si": "sinhala", | ||
"sk": "slovak", | ||
"sl": "slovenian", | ||
"so": "somali", | ||
"sq": "albanian", | ||
"sr": "serbian", | ||
"sr-Cyrl": "serbian (cyrillic)", | ||
"sr-Cyrl-BA": "serbian (cyrillic, bosnia and herzegovina)", | ||
"sr-Latn": "serbian (latin)", | ||
"sr-Latn-BA": "serbian (latin, bosnia and herzegovina)", | ||
"su": "sundanese", | ||
"sv": "swedish", | ||
"sw": "swahili", | ||
"sw-KE": "swahili (kenya)", | ||
"ta": "tamil", | ||
"te": "telugu", | ||
"tg": "tajik", | ||
"th": "thai", | ||
"ti": "tigrinya", | ||
"tk": "turkmen", | ||
"tn": "tswana", | ||
"to": "tongan", | ||
"tr": "turkish", | ||
"tt": "tatar", | ||
"ug": "uyghur", | ||
"uk": "ukrainian", | ||
"und": "undetermined", | ||
"ur": "urdu", | ||
"uz": "uzbek", | ||
"vi": "vietnamese", | ||
"wo": "wolof", | ||
"xh": "xhosa", | ||
"yi": "yiddish", | ||
"yo": "yoruba", | ||
"zh": "chinese", | ||
"zh-Hans": "chinese (simplified)", | ||
"zh-Hant": "chinese (traditional)", | ||
"zu": "zulu" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For lower and capitalization user input language, we need to dynamically handle it by
language.lower()