t.py for querying words
This commit is contained in:
parent
67e4d8b890
commit
86798097a1
20
t.py
Executable file
20
t.py
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/python
|
||||
import sys
|
||||
import os
|
||||
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}###")
|
||||
print("================================================================================")
|
||||
for k,v in d[query].items():
|
||||
if k != "type":
|
||||
print(f" {k}")
|
||||
print("--------------------------------------------------------------------------------")
|
||||
for ka in ["synonyms", "related" if "related" in v else "near synonyms", "near antonyms", "antonyms"]:
|
||||
print(f"{ka:^13}: {' | '.join(v[ka])}")
|
||||
print("--------------------------------------------------------------------------------")
|
Loading…
Reference in New Issue
Block a user