title: Backoff Tagger in nltk
body: <p>I am new to python coding.I want to use the UnigramTagger along with a backoff(which is in my case a RegexpTagger) and I have been struggling hard to figure out what the below error is. Appreciate any help on this.</p>
  
  <pre><code>&gt;&gt;&gt; train_sents = (['@Sakshi', 'Hi', 'I', 'am', 'meeting', 'my', 'friend', 'today'])    
  &gt;&gt;&gt; from tag_util import patterns  
  &gt;&gt;&gt; from nltk.tag import RegexpTagger  
  &gt;&gt;&gt; re_tagger = RegexpTagger(patterns)  
  &gt;&gt;&gt; from nltk.tag import UnigramTagger  
  &gt;&gt;&gt; from tag_util import backoff_tagger  
  &gt;&gt;&gt; tagger = backoff_tagger(train_sents, UnigramTagger, backoff=re_tagger)
  
  Traceback (most recent call last):  
   File "&lt;pyshell#6&gt;", line 1, in &lt;module&gt;  
      tagger = backoff_tagger(train_sents, UnigramTagger, backoff=re_tagger)  
    File "tag_util.py", line 12, in backoff_tagger  
       for cls in tagger_classes:  
  TypeError: 'YAMLObjectMetaclass' object is not iterable
  </code></pre>
  
  <p>This is the code I have in tag_util for patterns and backoff_tagger</p>
  
  <pre><code>import re  
  patterns = [  
      (r'^@\w+', 'NNP'),  
      (r'^\d+$', 'CD'),  
      (r'.*ing$', 'VBG'), # gerunds, i.e. wondering  
      (r'.*ment$', 'NN'),  
      (r'.*ful$', 'JJ'), # i.e. wonderful  
      (r'.*', 'NN')  
  ]  
  
  def backoff_tagger(train_sents, tagger_classes, backoff=None):
      for cls in tagger_classes:
          backoff = cls(train_sents, backoff=backoff)
      return backoff
  </code></pre>