title: fast way to search for a set of words in a list of words python
body: <p>I have a set of fixed words of size 20. I have a large file of 20,000 records, where each record contains a string and I want to find if any word from the fixed set is present in a string and if present the index of the word. </p>
  
  <p>example</p>
  
  <pre><code>s1=set([barely,rarely, hardly])#( actual size 20) 
  
  l2= =["i hardly visit", "i do not visit", "i can barely talk"] #( actual size 20,000)
  
  def get_token_index(token,indx):
      if token in s1:
          return indx
      else:
          return -1
  
  
  def find_word(text):
      tokens=nltk.word_tokenize(text)
      indexlist=[]
      for i in range(0,len(tokens)):
          indexlist.append(i)
      word_indx=map(get_token_index,tokens,indexlist)    
      for indx in word_indx:
          if indx !=-1:
             # Do Something with tokens[indx]
  </code></pre>
  
  <p>I want to know if there is a better/faster way to do it. </p>