-
Notifications
You must be signed in to change notification settings - Fork 71
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c690e88
created and added all the supported emoji languages
SethiShreya c7f20e4
deleted all the emoji-gen directories
SethiShreya c845d1b
convert language in supported-lang to lowercase for ease
SethiShreya 43458e7
created and integrated centralize emoji generation
SethiShreya 54f591b
created and integrated centralize emoji generation
SethiShreya 736ebc9
Merge branch 'main' into centralize-emoji
andrewtavis 4e07091
Remove JSON file so support check is based on CLDR directory in project
andrewtavis 50993a3
Remove unneeded language print
andrewtavis debaf02
Fix tests
andrewtavis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
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 os | ||
from pathlib import Path | ||
|
||
from scribe_data.unicode.process_unicode import gen_emoji_lexicon | ||
from scribe_data.utils import export_formatted_data, get_language_iso | ||
|
||
DATA_TYPE = "emoji-keywords" | ||
EMOJI_KEYWORDS_DICT = 3 | ||
|
||
|
||
def generate_emoji(language, output_dir: str = None): | ||
iso = get_language_iso(language=language) | ||
path_to_cldr_annotations = ( | ||
Path(__file__).parent / "cldr-annotations-full" / "annotations" | ||
) | ||
if iso in os.listdir(path_to_cldr_annotations): | ||
print(f"Emoji Generation for language {language} is supported") | ||
|
||
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, | ||
data_type=DATA_TYPE, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should use
language.capitalize()
, therefore noNo such file or directory: 'scribe_data_json_export/english/emoji_keywords.json'
will cause. In file data-type should be'{user_given_directory}/English/emoji_keywords.json'
Then we can call
scribe-data get -lang English -dt emoji_keywords -od ./output_data
and get the file inoutput_data