使用 mdict-utils 转换,由 csv 转换为词典 txt 文件使用了 jupyter notebook,以下为对应 python 代码片段
import csv
all_entries = []
with open('naer-terms.csv') as fd:
reader = csv.DictReader(fd)
for e in reader:
if e['en-US'] and e['zh-TW'] and e['domain']:
all_entries.append(f"{e['en-US']}\n<br><b>{e['en-US']}</b>: {e['zh-TW']}<br>— <small>{e['domain']}</small>")
joined_entries = '\n</>\n'.join(all_entries)
with open('naer-terms.txt', 'w') as of:
of.write(joined_entries)