title: Python: given a list of special tokens, show the distribution of said tokens across sublists of sentences
body: <p><strong>My problem has two parts, here is the first:</strong></p>
  <p>I have a list of lists like this:</p>
  <pre><code>big_list = [['i have an apple','i have a pear','i am a monkey', 'tell me about apples'],
  ['tell me about cars','tell me about trucks','tell me about planes']]
  </code></pre>
  <p>I also have a list of words like this:</p>
  <pre><code>words = ['i','have','monkey','tell','me','about']
  </code></pre>
  <p>I want to iterate through <strong>big_list</strong>, checking whether each sublist contains <em>more than one element from <strong>words</strong> in sequence</em>. For example, <strong>big_list[0]</strong> would contain <strong>'i have'</strong> from the first and second elements and <strong>'tell me about'</strong> in the final element.</p>
  <p>Currently I am trying this at the level of the sublist where i first tokenize all strings in a sublist so that i can iterate through their elements to see where elements from <strong>words</strong> occur:</p>
  <pre><code>import nltk
  example = big_list[0]
  example_sentences_tokens = []
  for sentence in example:
      example_sentences_tokens.append([token.lower() for token in nltk.tokenize.word_tokenize(sentence)])
  </code></pre>
  <p>Having access to both original strings and tokenized strings, I check where elements from <strong>words</strong> occur:</p>
  <pre><code>tuples = []
  for sentence, tokenized_sentence in zip(example,example_sentences_tokens):
      tuples.append(tuple((sentence,[token for token in example_sentences_tokens if token in words])))
  </code></pre>
  <p>Now, <strong>tuples</strong> is a list of tuples each containing every sentence from <strong>big_list[0]</strong> and all elements of said sentence which exist in <strong>words</strong>.</p>
  <p>However, I only want to include tokens existing in <strong>words</strong> if they occur in sequence, not if they occur alone. How can I do this?</p>
  <p><strong>The second part of the problem:</strong>
  Finally, once I've identified all instances where a sequence of elements from <strong>words</strong> appears together somewhere in <strong>big_list</strong>, id like to show the frequency of those element sequences in all sublists. So <strong>tell me about</strong> occurs in 100% of <strong>big_list[1]</strong> and 33% of <strong>big_list[0]</strong>. Is there a simple way to show this distribution?</p>