Skip to content
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

#14 download and load cldr data #24

Merged
merged 2 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ dist
*.egg-info
# Caches
__pycache__

# NPM files
###########
node_modules
package-lock.json
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"cldr-annotations-derived-full": "latest"
}
}
19 changes: 18 additions & 1 deletion src/scribe_data/extract_transform/process_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
gen_emoji_autosuggestions
"""

import json

from scribe_data.load.update_utils import get_language_iso

def gen_emoji_autosuggestions(
language="English",
num_emojis=500,
Expand Down Expand Up @@ -42,6 +46,19 @@ def gen_emoji_autosuggestions(

autosuggest_dict = {}

# TODO
### TODO further updates - here for data loading illustration

language = get_language_iso(language)

cldr_file_path = f'node_modules/cldr-annotations-derived-full/annotationsDerived/{language}/annotations.json'

with open(cldr_file_path, 'r') as file:
cldr_data = json.load(file)

emoji_dict = cldr_data['annotationsDerived']['annotations']

print("Number of emojis loaded:", len(emoji_dict))

###

return autosuggest_dict
2 changes: 1 addition & 1 deletion src/scribe_data/extract_transform/process_wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def gen_autosuggestions(
ignore_words : str or list (default=None)
Strings that should be removed from the text body.

update_scribe : bool (default=False)
update_scribe_apps : bool (default=False)
Saves the created dictionaries as JSONs in Scribe app directories.

verbose : bool (default=True)
Expand Down
20 changes: 20 additions & 0 deletions src/scribe_data/load/gen_emoji_suggestions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@
"pwd = pwd.split(\"scribe_data\")[0]\n",
"sys.path.append(pwd)"
]
},
{
"cell_type": "markdown",
"id": "2add942e",
"metadata": {},
"source": [
"# Download Latest Unicode"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8e166da1",
"metadata": {},
"outputs": [],
"source": [
"%%bash\n",
". $HOME/.nvm/nvm.sh # Pick up the 'npm' command\n",
"npm install"
]
}
],
"metadata": {
Expand Down