You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
377 B
Python

import nltk
import json
nltk.download('wordnet')
from nltk.corpus import wordnet
# 获取常用单词列表
common_words = list(wordnet.words())
# 选择前2000个常用单词
# word_list = common_words[:2000]
# 转换为 JSON 格式
json_data = json.dumps(common_words)
# 将数据写入 JSON 文件
with open('common_words.json', 'w') as file:
file.write(json_data)