Python check if any part of string in list
<p>I have a list containing synonyms for the word 'Good' (this list here is shortened)</p>

<pre><code>good_synonym = ['Good','good','Well','well']
</code></pre>

<p>And the program asks how the user is feeling</p>

<pre><code>print = 'Hello, ' + name + ', How are you?'
status = raw_input('')
</code></pre>

<p>But sometimes, the user may respond to the question with "I am good" (or similar)</p>

<p>If the answer contains a word in the good synonym list, I want the program to reply</p>

<pre><code>if status contains a word in good_synonym:
    print ('That is good')
else:
    print ('That is not so good')
</code></pre>

<h1>note that the first line is not real python language</h1>

<p>But I don't know which phrase to use to do the action.</p>

<p>This is a NLP question, the following code is a simple version of detecting synonym:</p>

<pre><code>def is_contains_synonym(sentence, synonym):
    token = sentence.split(' ')
    return len(filter(lambda x: x in synonym, token)) &gt; 0

if is_contains_synonym(status, good_synonym):
    print ('That is good')
else:
    print ('That is not so good')
</code></pre>

python