How do I perform exact string match on python
<p>I have a set of words</p>

<p>words = {'thanks giving', 'cat', 'instead of',etc...}</p>

<p>I need to search exactly these words in table column 'description' </p>

<pre><code>--------------------------------|
ID  | Description               |
--- |---------------------------|
1   | having fun   thanks giving| 
----|---------------------------|
2   |  cat eats all the food    |
----|---------------------------|
3   |  instead you can come     | 
--------------------------------

def matched_words(x,words):
   match_words =[]
  for word in words:
     if word in x:
       match_words.append(word)
  return match_words

df['new_col'] = df['description'].apply(lambda x:matched_words(x,words))
</code></pre>

<p>desired output :</p>

<pre><code>----|---------------------------|-------------------|
ID  | Description               |matched words      |
--- |---------------------------|-------------------|
1   | having fun   thanks giving|['thanks giving']  |
----|---------------------------|------------------ |
2   |  cat eats all the food    |['cat']            |
----|---------------------------|-------------------|
3   |  instead you can come     | []                |
----------------------------------------------------
</code></pre>

<p>I'm getting matches only single tokens like ['cat']</p>