【发布时间】:2021-01-13 12:54:13
【问题描述】:
lemmatizer = WordNetLemmatizer
intents = json.loads(open('intents.json').read())
words = []
classes = []
documents = []
ignore_letters = ['?', '!', '.', ',']
for intent in intents['intents']:
for pattern in intent['patterns']:
word_list = nltk.word_tokenize(pattern)
words.extend(word_list)
documents.append((word_list, intent['tag']))
if intent['tag'] not in classes:
classes.append(intent['tag'])
words = [lemmatizer.lemmatize(word) for word in words if word not in ignore_letters]
words = sorted(set(words))
lemmatizer.lemmatize(word) 中有一个错误,它一直在说-
“参数‘字’未填写”。 确切的错误是-
TypeError: lemmatize() missing 1 required positional argument: 'word'
【问题讨论】:
-
请准确粘贴错误信息。我不知道有任何异常说
unfilled。 -
这是一直显示的错误:TypeError: lemmatize() missing 1 required positional argument: 'word'
标签: python python-3.x tensorflow