import nltk from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet from nltk.tokenize import word_tokenize class Chatbot: def __init__(self): self.lemmatizer = WordNetLemmatizer() def get_wordnet_pos(self, word): tag = nltk.pos_tag([word])[0][1][0].upper() tag_dict = {"J": wordnet.ADJ, "N": wordnet.NOUN, "V": wordnet.VERB, "R": wordnet.ADV} return tag_dict.get(tag, wordnet.NOUN)..