Dictionary Print Out All Word Of What I Type In
<p>I need to create a program which prints out all the word in the dictionary that I wrote, So let's say I write house, It could come out like</p>

<blockquote>
  <p>home, house, high, hollow, out, over, overrated, on, united, untitled, urgent, song, silent, silence, sorry, emotion, elf, egg, end</p>
</blockquote>

<p>So it gets all the word out of my dictionary with the word I wrote in, here is the code.</p>

<pre><code>#User types in a word
word = input("Type in a word: ")

#initiate the dictionary struct.
dictionary = {}
#run through the dictionary file, one line at a time.
with open("dict.txt") as dict_filehandle:
for cword in dict_filehandle:
#here a single line has been placed into the variable cword.

    #no newlines are allowed in the words.
    cword=cword.replace("\n","");

    #give the given word the value 1.
    dictionary[cword]=1;

#here we have a dictionary struct.

#here we push through all the words in the dictionary


print(dictionary["house"])
</code></pre>

<p>In the code I have above, I made it search "house" and it shows that it's true by getting the number 1, I don't know how to do the thing I said above but I need to be able to do it since it's a school project and my teacher recommended for us to look on the internet so I decided to just ask people.</p>

<p>Maybe not a crisp solution, but an approach and an explanation that is longer for a comment: </p>

<p>Before you could get all the words that match a particular word someone gives to your program, you need to classify the words in your file into categories and establish mappings. That is, it should be established somewhere, preferably in your data file, to which words an entry can map to. This however, is a bit of a complex task. As you can see, a given word and the other words you want to refer to that word needs to be modeled through some logic. Building this logic is the entirety of your problem. If what you need is to give standard synonyms for a given word, I can suggest something like: <a href="https://www.wordsapi.com/" rel="nofollow">words api</a>. I am not really aware of how their api works and what the usage limits are. If you do a bit of searching, you might be able to find an open source solution as well. Good luck! </p>

python project