title: extracting sentences from pos-tagged corpus with certain word, tag combos
body: <p>I'm playing with the brown corpus, specifically the tagged sentences in "news." I've found that "to" is the word with the most ambiguous word tags (TO, IN, TO-HL, IN-HL, IN-TL, NPS). I'm trying to write a code that will print one sentence from the corpus for each tag associated with "to". The sentences do not need to be "cleaned" of the tags, but just contain both "to" and one each of the associated pos-tags.</p>
  
  <pre><code>brown_sents = nltk.corpus.brown.tagged_sents(categories="news")
  for sent in brown_sents:
      for word, tag in sent:
          if (word == 'to' and tag == "IN"):
              print sent
  </code></pre>
  
  <p>I tried the above code with just one of the pos-tags to see if it worked, but it prints all the instances of this. I need it to print just the first found sentence that matches the word, tag and then stop. I tried this:</p>
  
  <pre><code>for sent in brown_sents:
      for word, tag in sent:
          if (word == 'to' and tag == 'IN'):
              print sent
          if (word != 'to' and tag != 'IN'):
              break
  </code></pre>
  
  <p>This works with this pos-tag because it's the first one related to "to", but if I use:</p>
  
  <pre><code>for sent in brown_sents:
      for word, tag in sent:
          if (word == 'to' and tag == 'TO-HL'):
              print sent
          if (word != 'to' and tag != 'TO-HL'):
              break
  </code></pre>
  
  <p>It returns nothing. I think I am SO close -- care to help?</p>