21 lines
870 B
Python
21 lines
870 B
Python
import json
|
||
|
||
with open("oracle_enricher/data/lexicon.json") as f:
|
||
words = json.load(f)
|
||
|
||
sorted_words = sorted(words, key=lambda w: w["word"].lower().replace("ё", "е9"))
|
||
|
||
with open("words_alphabetical.txt", "w", encoding="utf-8") as f:
|
||
for i, w in enumerate(sorted_words, 1):
|
||
f.write(f"{i}. {w["word"]} {w["emoji"]} (id: {w["id"]})\n")
|
||
|
||
with open("words_alphabetical.md", "w", encoding="utf-8") as f:
|
||
f.write("# Алфавитный список 1000 слов Оракула\n\n")
|
||
f.write("| № | Слово | Эмодзи | ID | Часть речи | Категория |\n")
|
||
f.write("|---|---|---|---|---|---|\n")
|
||
for i, w in enumerate(sorted_words, 1):
|
||
wid = w["id"]
|
||
f.write(f"| {i} | **{w["word"]}** | {w["emoji"]} | #{wid:03d} | {w["pos"]} | {w["category"]} |\n")
|
||
|
||
print("Alphabetical files updated successfully!")
|