remove synonyms and antonyms from MW, fix pronounciation

This commit is contained in:
julius 2022-12-09 19:18:59 +00:00
parent 5c5397437c
commit 0c11d07523

View File

@ -36,7 +36,7 @@ class MerriamWebsterParser(WordParser):
@property @property
def pronounciation(self): def pronounciation(self):
prs = [] prs = []
for e in self.root.findall(".//*[@class='pr']"): for e in self.root.findall(".//span[@class='mw no-badge']"):
prs.append(ot(e)) prs.append(ot(e))
return list(set(prs)) return list(set(prs))
@ -121,9 +121,9 @@ class MerriamWebsterParser(WordParser):
"type": self.type, "type": self.type,
"definitions": self.definitions, "definitions": self.definitions,
"pronounciation": self.pronounciation, "pronounciation": self.pronounciation,
"synonyms": self.synonyms, # "synonyms": self.synonyms,
"antonyms": self.antonyms, # "antonyms": self.antonyms,
"synonym_discussion": self.synonym_discussion, # "synonym_discussion": self.synonym_discussion,
"examples": self.examples, "examples": self.examples,
"history_and_etymology": self.history_and_etymology, "history_and_etymology": self.history_and_etymology,
"first_known_use": self.first_known_use, "first_known_use": self.first_known_use,
@ -133,14 +133,14 @@ class MerriamWebsterParser(WordParser):
) )
testword = "domicile" # testword = "domicile"
d = MerriamWebsterParser(testword) # d = MerriamWebsterParser(testword)
# print(d.definitions) # # print(d.definitions)
print(d.neighbours) # print(d.neighbours)
word_dict = d.todict() # word_dict = d.todict()
for k, v in word_dict[testword].items(): # for k, v in word_dict[testword].items():
print(f"### {k} ###\n", v) # print(f"### {k} ###\n", v)
exit() # exit()
q = Queue(MerriamWebsterParser, "en_MerriamWebster/", "_MW.json") q = Queue(MerriamWebsterParser, "en_MerriamWebster/", "_MW.json")
q.loadDB() q.loadDB()