Skip to content

Commit

Permalink
#95 add method to add a new language via edit to total_data.json
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Jan 16, 2022
1 parent a934fc6 commit fbe0088
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Data/update_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
current_languages = list(current_data.keys())
word_types = ["nouns", "verbs", "prepositions"]

# Check to see if the language has all zeroes for its data, meaning it's been added.
new_language_list = []
for lang in current_languages:
current_data = list({current_data[lang][w] for w in word_types})
if len(current_data) == 1 and current_data[0] == 0:
new_language_list.append(lang)

language = None
word_type = None
if len(sys.argv) == 2:
Expand Down Expand Up @@ -159,7 +166,17 @@
data_added_string = ""
language_keys = list(data_added_dict.keys())
for l in language_keys:
data_added_string += f"- {l}: " if l == language_keys[0] else f"\n- {l}: "
if l == language_keys[0]:
if l in new_language_list:
data_added_string += f"- {l} (New): "
else:
data_added_string += f"- {l}: "
else:
if l in new_language_list:
data_added_string += f"\n- {l} (New): "
else:
data_added_string += f"\n- {l}: "

for w in word_types:
if data_added_dict[l][w] == 0:
pass
Expand Down

0 comments on commit fbe0088

Please sign in to comment.