improved database

This commit is contained in:
Jonas Weinz 2023-03-26 17:17:56 +02:00
parent d18c115a9c
commit 54a8f26eca
4 changed files with 23505 additions and 12 deletions

23493
data/nltk_corpus.ipynb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -13,14 +13,14 @@ def get_difficulty_threshold(lang: str, difficulty: int):
get_difficulty_threshold.thresholds = { get_difficulty_threshold.thresholds = {
'de': { 'de': {
0: 10, 0: 3,
1: 6, 1: 2,
2: 0 2: 1
}, },
'en': { 'en': {
0: 150, 0: 5,
1: 100, 1: 2,
2: 10 2: 1
} }
} }
@ -50,8 +50,8 @@ def get_database(lang: str = "en", difficulty: int = -1) -> dict:
db = get_database._dbs[lang][-1] db = get_database._dbs[lang][-1]
new_db = {} new_db = {}
for word_key, item in db.items(): for word_key, item in db.items():
num_translations = item['num_translations'] frequency = item['frequency']
if num_translations >= t: if frequency >= t:
new_db[word_key] = item new_db[word_key] = item
get_database._dbs[lang][difficulty] = new_db get_database._dbs[lang][difficulty] = new_db

BIN
server/de.json (Stored with Git LFS)

Binary file not shown.

BIN
server/en.json (Stored with Git LFS)

Binary file not shown.