dict_dl/t.py

32 lines
873 B
Python
Raw Normal View History

2022-07-08 15:42:55 +00:00
#!/bin/python
import os
2022-07-10 03:16:16 +00:00
import sys
2022-07-08 15:42:55 +00:00
os.chdir("/home/julius/bookshelf/dict_dl/")
from dict_dl import Dictionary
query = sys.argv[1]
prefix = query[:2]
d = Dictionary("en_MW_thesaurus/", f"{prefix}_mwt.json")
print(f"### {query:<70}###")
2022-07-10 04:35:09 +00:00
print(
"================================================================================"
)
for k, v in d[query].items():
2022-07-08 15:42:55 +00:00
if k != "type":
print(f" {k}")
2022-07-10 04:35:09 +00:00
print(
"--------------------------------------------------------------------------------"
)
for ka in [
"synonyms",
"related" if "related" in v else "near synonyms",
"near antonyms",
"antonyms",
]:
print(f"{ka:^13}: {' | '.join(v[ka])}")
print(
"--------------------------------------------------------------------------------"
)