title: Python matching n-grams from a dictionary to a string of text
body: <p>I have a dictionary of 2 and 3 word phrases that I want to search in rss feeds for a match. I grab the rss feeds, process them and they end up as a string in a list entitled "documents". I want to check the dictionary below and if any of the phrases in the dictionary match part of a string of text I want to return the values for the key. I am not sure about the best way to approach this problem. Any suggestions would be greatly appreciated.</p>
  
  <pre><code>ngramList = {"cash outflows":-1, "pull out":-1,"winding down":-1,"most traded":-1,"steep gains":-1,"military strike":-1,
            "resumed operations":+1,"state aid":+1,"bail out":-1,"cut costs":-1,"alleged violations":-1,"under perform":-1,"more than expected":+1,
           "pay more taxes":-1,"not for sale":+1,"struck a deal":+1,"cash flow problems":-2}
  </code></pre>