code: def tag(self, corpus, tokenize=True):
          '''Tags a string `corpus`.'''
          # Assume untokenized corpus has \n between sentences and ' ' between words
          s_split = SentenceTokenizer().tokenize if tokenize else lambda t: t.split('\n')
          w_split = WordTokenizer().tokenize if tokenize else lambda s: s.split()
          def split_sents(corpus):
              for s in s_split(corpus):
                  yield w_split(s)
  
          prev, prev2 = self.START
          tokens = []
          for words in split_sents(corpus):
              context = self.START + [self._normalize(w) for w in words] + self.END
              for i, word in enumerate(words):
                  tag = self.tagdict.get(word)
                  if not tag:
                      features = self._get_features(i, word, context, prev, prev2)
                      tag = self.model.predict(features)
                  tokens.append((word, tag))
                  prev2 = prev
                  prev = tag
          return tokenf tag(self, corpus, tokenize=True):
          '''Tags a string `corpus`.'''
          # Assume untokenized corpus has \n between sentences and ' ' between words
          s_split = SentenceTokenizer().tokenize if tokenize else lambda t: t.split('\n')
          w_split = WordTokenizer().tokenize if tokenize else lambda s: s.split()
          def split_sents(corpus):
              for s in s_split(corpus):
                  yield w_split(s)
  
          prev, prev2 = self.START
          tokens = []
          for words in split_sents(corpus):
              context = self.START + [self._normalize(w) for w in words] + self.END
              for i, word in enumerate(words):
                  tag = self.tagdict.get(word)
                  if not tag:
                      features = self._get_features(i, word, context, prev, prev2)
                      tag = self.model.predict(features)
                  tokens.append((word, tag))
                  prev2 = prev
                  prev = tag
          return tokens
docs: Tags a string `corpus`.