Python, match bigram dict with the text
<p>I'm struggling with matching a sentence of 3 words with a digram dictionary of two words, which counts the frequency of the ( 1st word and 2nd word ) and (2nd word and 3rd word). What I want is how to match that the string ( AAA BBB CCC) is in the bigram and (AAA BBB) has a count and also (BBB CCC) has a count and then we take the max?</p>

<pre><code>Counter({
('BBB', 'DDD'): 3, 
('AAA', 'BBB'): 2, 
('DDD', 'XXX'): 1, 
('DDD', 'YYY'): 1,
('YYY', 'BBB'): 1, 
('BBB', 'CCC'): 1, 
('CCC', 'AAA'): 1, 
('XXX', 'BBB'): 1})
</code></pre>
