输入:word_types 列表,例如 ["verb", "adjective", "name", "noun]
期望的输出:按 word_type 排列的每个字母-word_type 组合的三个单词的字典。
IE
{“动词”:[“Averb1”,“Averb2”,“Averb3”],[Bverb1,...],...,“形容词”:[“Aadjective1”,“Aadjectives2”,“Aadjectives3”] .. 。 ETC
这是我用来生成数据的内容。
import string
A_to_Z = list(string.ascii_uppercase) # list of letters a-z
lettered_word_types = ["verb", "adjective", "name", "noun"]
class Lexicon:
def __init__(self, testing = True):
if testing == True:
for TYPE in lettered_word_types:
setattr(self, TYPE + "s", [letter + TYPE for letter in A_to_Z])
self.__dict__ = {key: [[element + "1", element + "2", element + "3"] for element in value] for key, value in self.__dict__.items()}
data = Lexicon().__dict__
冉冉说
相关分类