class_docstr: Greedy Averaged Perceptron tagger, as implemented by Matthew Honnibal.
  See more implementation details here:
  https://explosion.ai/blog/part-of-speech-pos-tagger-in-python
  
  >>> from nltk.tag.perceptron import PerceptronTagger
  
  Train the model
  
  >>> tagger = PerceptronTagger(load=False)
  
  >>> tagger.train([[('today','NN'),('is','VBZ'),('good','JJ'),('day','NN')],
  ... [('yes','NNS'),('it','PRP'),('beautiful','JJ')]])
  
  >>> tagger.tag(['today','is','a','beautiful','day'])
  [('today', 'NN'), ('is', 'PRP'), ('a', 'PRP'), ('beautiful', 'JJ'), ('day', 'NN')]
  
  Use the pretrain model (the default constructor)
  
  >>> pretrain = PerceptronTagger()
  
  >>> pretrain.tag('The quick brown fox jumps over the lazy dog'.split())
  [('The', 'DT'), ('quick', 'JJ'), ('brown', 'NN'), ('fox', 'NN'), ('jumps', 'VBZ'), ('over', 'IN'), ('the', 'DT'), ('lazy', 'JJ'), ('dog', 'NN')]
  
  >>> pretrain.tag("The red cat".split())
  [('The', 'DT'), ('red', 'JJ'), ('cat', 'NN')]
class_docstr_tok: ["Greedy","Averaged","Perceptron","tagger",",","as","implemented","by","Matthew","Honnibal",".","See","more","implementation","details","here",":","https",":","\/\/explosion.ai\/blog\/part-of-speech-pos-tagger-in-python",">",">",">","from","nltk.tag.perceptron","import","PerceptronTagger","Train","the","model",">",">",">","tagger","=","PerceptronTagger","(","load=False",")",">",">",">","tagger.train","(","[","[","(","'today","'",",","'NN","'",")",",","(","'is","'",",","'VBZ","'",")",",","(","'good","'",",","'JJ","'",")",",","(","'day","'",",","'NN","'",")","]",",","...","[","(","'yes","'",",","'NNS","'",")",",","(","'it","'",",","'PRP","'",")",",","(","'beautiful","'",",","'JJ","'",")","]","]",")",">",">",">","tagger.tag","(","[","'today","'",",","'is","'",",","'","a","'",",","'beautiful","'",",","'day","'","]",")","[","(","'today","'",",","'NN","'",")",",","(","'is","'",",","'PRP","'",")",",","(","'","a","'",",","'PRP","'",")",",","(","'beautiful","'",",","'JJ","'",")",",","(","'day","'",",","'NN","'",")","]","Use","the","pretrain","model","(","the","default","constructor",")",">",">",">","pretrain","=","PerceptronTagger","(",")",">",">",">","pretrain.tag","(","'The","quick","brown","fox","jumps","over","the","lazy","dog'.split","(",")",")","[","(","'The","'",",","'DT","'",")",",","(","'quick","'",",","'JJ","'",")",",","(","'brown","'",",","'NN","'",")",",","(","'fox","'",",","'NN","'",")",",","(","'jumps","'",",","'VBZ","'",")",",","(","'over","'",",","'IN","'",")",",","(","'the","'",",","'DT","'",")",",","(","'lazy","'",",","'JJ","'",")",",","(","'dog","'",",","'NN","'",")","]",">",">",">","pretrain.tag","(","``","The","red","cat","''",".split","(",")",")","[","(","'The","'",",","'DT","'",")",",","(","'red","'",",","'JJ","'",")",",","(","'cat","'",",","'NN","'",")","]"]
docstr: Map tokens into a feature representation, implemented as a
  {hashable: int} dict. If the features change, a new model must be
  trained.
docstr_tok: ["Map","tokens","into","a","feature","representation",",","implemented","as","a","{","hashable",":","int","}","dict",".","If","the","features","change",",","a","new","model","must","be","trained","."]
code: def _get_features(self, i, word, context, prev, prev2):
      """Map tokens into a feature representation, implemented as a
      {hashable: int} dict. If the features change, a new model must be
      trained.
      """
  
      def add(name, *args):
          features[" ".join((name,) + tuple(args))] += 1
  
      i += len(self.START)
      features = defaultdict(int)
      # It's useful to have a constant feature, which acts sort of like a prior
      add("bias")
      add("i suffix", word[-3:])
      add("i pref1", word[0] if word else "")
      add("i-1 tag", prev)
      add("i-2 tag", prev2)
      add("i tag+i-2 tag", prev, prev2)
      add("i word", context[i])
      add("i-1 tag+i word", prev, context[i])
      add("i-1 word", context[i - 1])
      add("i-1 suffix", context[i - 1][-3:])
      add("i-2 word", context[i - 2])
      add("i+1 word", context[i + 1])
      add("i+1 suffix", context[i + 1][-3:])
      add("i+2 word", context[i + 2])
      return features
  
imports: import logging
  import pickle
  import random
  from collections import defaultdict
  from nltk import jsontags
  from nltk.data import find, load
  from nltk.tag.api import TaggerI
label_desc: Use image node_id 8 for calling the PerceptronTagger obj's underlying member method code with example usage: obj._get_features(i, word, context, prev, prev2) and returns: features