I am using PyDictionary for a project but I need to find a way to see if the meaning of the word I am searching up the meaning for contains the word "greeting".
This is my code:
from PyDictionary import PyDictionaryfrom random import randintdef contains_word(s, w): return (''+ w +'') in (''+ s +'')greetings = ["hi", "hello", "hey", "helloo", "hellooo", "greetings", "greeting", "howdy"]usr_input = input("Input:")split_input = usr_input.split()dictionary=PyDictionary(split_input)dictionarystr = str(dictionary)if contains_word(dictionarystr, 'greeting'): print(greetings[randint(0,8)])print(contains_word(dictionarystr, 'greeting'))print(dictionarystr)But it doesnt work. Instead I get false and I look at what the dictionarystr variable is and it says <PyDictionary Object with 1 words>.