Temporary new makedict.py
successfully build LEXiTRON 2.0 from official CSV fileunknown
python
a year ago
1.1 kB
15
Indexable
from yomitandic import DicEntry, Dictionary, create_html_element
import csv
import pandas as pd
import numpy as np
pd_df_dict = pd.read_csv("LEXiTRON_2.0_csv/telex.csv")
clean_df = pd_df_dict.drop(["t-entry","t-def"], axis=1)
# Making dictionary
dictionary = Dictionary("LEXiTRON TH-EN 2.0")
for id in list(clean_df.loc[:,"id"]):
if not pd.isna(clean_df.loc[id, "t-search"]):
word = clean_df.loc[id, "t-search"]
syn = clean_df.loc[id, "t-syn"] if type(clean_df.loc[id, "t-syn"]) != float else "-"
ant = clean_df.loc[id, "t-ant"] if type(clean_df.loc[id, "t-ant"]) != float else "-"
definition = clean_df.loc[id, "e-entry"] if type(clean_df.loc[id, "e-entry"]) != float else "-"
tag = clean_df.loc[id, "t-cat"] if type(clean_df.loc[id, "t-cat"]) != float else "NA"
sample = clean_df.loc[id, "t-sample"] if type(clean_df.loc[id, "t-sample"]) != float else "-"
entry = DicEntry(word=str(word), reading="", definition=f"[{tag}.] {definition}\nEx.:{sample}\nSyn.:{syn}\nAnt.:{ant}", tag="")
dictionary.add_entry(entry)
dictionary.export()Editor is loading...
Leave a Comment