title: How to check whether a element from given list is in text or not using python?
body: <p>I have to check whether a element from given list is in text or not,if it is a single word i can,but if it contains multiple words  like below i am not able to get</p>
  
  <pre><code>text="what is the price of wheat and White Pepper?"
  
  words=['wheat','White Pepper','rice','pepper']
  
  Expected output=['wheat','White Pepper']
  </code></pre>
  
  <p>I tried in below ways ,but not getting expected output,can anyone help me?</p>
  
  <pre><code>&gt;&gt;&gt; output=[word for word in words if word in text]
  
  &gt;&gt;&gt; print output
  
  &gt;&gt;&gt; ['rice', 'White Pepper', 'wheat']
  </code></pre>
  
  <p>here it is taking word "rice" from word "price"</p>
  
  <p>If i use nltk or any it will split "White Pepper" into "White" and "pepper"</p>
  
  <pre><code>&gt;&gt;&gt; from nltk import word_tokenize
  
  &gt;&gt;&gt; n_words=word_tokenize(text)
  
  &gt;&gt;&gt; print n_words
  
  &gt;&gt;&gt; ['what', 'is', 'the', 'price', 'of', 'wheat', 'and', 'White', 'Pepper', '?']
  
  &gt;&gt;&gt; output=[word for word in words if word in n_words]
  &gt;&gt;&gt; print output
  
  &gt;&gt;&gt; ['wheat']
  </code></pre>