class_docstr: Brill's transformational rule-based tagger.  Brill taggers use an
  initial tagger (such as ``tag.DefaultTagger``) to assign an initial
  tag sequence to a text; and then apply an ordered list of
  transformational rules to correct the tags of individual tokens.
  These transformation rules are specified by the ``TagRule``
  interface.
  
  Brill taggers can be created directly, from an initial tagger and
  a list of transformational rules; but more often, Brill taggers
  are created by learning rules from a training corpus, using one
  of the TaggerTrainers available.
docstr: Tags by applying each rule to the entire corpus (rather than all rules to a
  single sequence). The point is to collect statistics on the test set for
  individual rules.
  
  NOTE: This is inefficient (does not build any index, so will traverse the entire
  corpus N times for N rules) -- usually you would not care about statistics for
  individual rules and thus use batch_tag() instead
  
  :param sequences: lists of token sequences (sentences, in some applications) to be tagged
  :type sequences: list of list of strings
  :param gold: the gold standard
  :type gold: list of list of strings
  :returns: tuple of (tagged_sequences, ordered list of rule scores (one for each rule))
docstr_tok: ["Tags","by","applying","each","rule","to","the","entire","corpus","(","rather","than","all","rules","to","a","single","sequence",")",".","The","point","is","to","collect","statistics","on","the","test","set","for","individual","rules",".","NOTE",":","This","is","inefficient","(","does","not","build","any","index",",","so","will","traverse","the","entire","corpus","N","times","for","N","rules",")","--","usually","you","would","not","care","about","statistics","for","individual","rules","and","thus","use","batch_tag","(",")","instead",":","param","sequences",":","lists","of","token","sequences","(","sentences",",","in","some","applications",")","to","be","tagged",":","type","sequences",":","list","of","list","of","strings",":","param","gold",":","the","gold","standard",":","type","gold",":","list","of","list","of","strings",":","returns",":","tuple","of","(","tagged_sequences",",","ordered","list","of","rule","scores","(","one","for","each","rule",")",")"]
code: def batch_tag_incremental(self, sequences, gold):
      """
      Tags by applying each rule to the entire corpus (rather than all rules to a
      single sequence). The point is to collect statistics on the test set for
      individual rules.
  
      NOTE: This is inefficient (does not build any index, so will traverse the entire
      corpus N times for N rules) -- usually you would not care about statistics for
      individual rules and thus use batch_tag() instead
  
      :param sequences: lists of token sequences (sentences, in some applications) to be tagged
      :type sequences: list of list of strings
      :param gold: the gold standard
      :type gold: list of list of strings
      :returns: tuple of (tagged_sequences, ordered list of rule scores (one for each rule))
      """
  
      def counterrors(xs):
          return sum(
              t[1] != g[1]
              for pair in zip(xs, gold)
              for (t, g) in zip(*pair)
          )
  
      testing_stats = {}
      testing_stats["tokencount"] = sum(len(t) for t in sequences)
      testing_stats["sequencecount"] = len(sequences)
      tagged_tokenses = [
          self._initial_tagger.tag(tokens) for tokens in sequences
      ]
      testing_stats["initialerrors"] = counterrors(tagged_tokenses)
      testing_stats["initialacc"] = (
          1
          - testing_stats["initialerrors"] / testing_stats["tokencount"]
      )
      # Apply each rule to the entire corpus, in order
      errors = [testing_stats["initialerrors"]]
      for rule in self._rules:
          for tagged_tokens in tagged_tokenses:
              rule.apply(tagged_tokens)
          errors.append(counterrors(tagged_tokenses))
      testing_stats["rulescores"] = [
          err0 - err1 for (err0, err1) in zip(errors, errors[1:])
      ]
      testing_stats["finalerrors"] = errors[-1]
      testing_stats["finalacc"] = (
          1 - testing_stats["finalerrors"] / testing_stats["tokencount"]
      )
      return (tagged_tokenses, testing_stats)
  
imports: from collections import Counter, defaultdict
  from nltk import jsontags
  from nltk.tag import TaggerI
  from nltk.tbl import Feature, Template
label_desc: Use image node_id 8 for calling the BrillTagger obj's underlying member method code with example usage: obj.batch_tag_incremental(sequences, gold) and returns: tagged_tokenses,  testing_stats, sum