class_docstr: An averaged perceptron, as implemented by Matthew Honnibal.
  
  See more implementation details here:
      https://explosion.ai/blog/part-of-speech-pos-tagger-in-python
class_docstr_tok: ["An","averaged","perceptron",",","as","implemented","by","Matthew","Honnibal",".","See","more","implementation","details","here",":","https",":","\/\/explosion.ai\/blog\/part-of-speech-pos-tagger-in-python"]
docstr: Dot-product the features and current weights and return the best label.
docstr_tok: ["Dot-product","the","features","and","current","weights","and","return","the","best","label","."]
code: def predict(self, features, return_conf=False):
      """Dot-product the features and current weights and return the best label."""
      scores = defaultdict(float)
      for feat, value in features.items():
          if feat not in self.weights or value == 0:
              continue
          weights = self.weights[feat]
          for label, weight in weights.items():
              scores[label] += value * weight
  
      # Do a secondary alphabetic sort, for stability
      best_label = max(
          self.classes, key=lambda label: (scores[label], label)
      )
      # compute the confidence
      conf = max(self._softmax(scores)) if return_conf == True else None
  
      return best_label, conf
  
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 3 for calling the AveragedPerceptron obj's underlying member method code with example usage: obj.predict(features, return_conf) and returns: best_label,  conf