class_docstr: This class implements the actual language identifier.
class_docstr_tok: ["This","class","implements","the","actual","language","identifier","."]
code: def __init__(
      self,
      nb_ptc,
      nb_pc,
      nb_numfeats,
      nb_classes,
      tk_nextmove,
      tk_output,
      norm_probs=NORM_PROBS,
  ):
      self.nb_ptc = nb_ptc
      self.nb_pc = nb_pc
      self.nb_numfeats = nb_numfeats
      self.nb_classes = nb_classes
      self.tk_nextmove = tk_nextmove
      self.tk_output = tk_output
  
      if norm_probs:
  
          def norm_probs(pd):
              """
              Renormalize log-probs into a proper distribution (sum 1)
              The technique for dealing with underflow is described in
              http://jblevins.org/log/log-sum-exp
              """
              # Ignore overflow when computing the exponential. Large values
              # in the exp produce a result of inf, which does not affect
              # the correctness of the calculation (as 1/x->0 as x->inf).
              # On Linux this does not actually trigger a warning, but on
              # Windows this causes a RuntimeWarning, so we explicitly
              # suppress it.
              with np.errstate(over="ignore"):
                  pd_exp = np.exp(pd)
                  pd = pd_exp / pd_exp.sum()
              return pd
  
      else:
  
          def norm_probs(pd):
              return pd
  
      self.norm_probs = norm_probs
  
      # Maintain a reference to the full model, in case we change our language set
      # multiple times.
      self.__full_model = nb_ptc, nb_pc, nb_classes
  
imports: from __future__ import print_function
  import base64
  import bz2
  import json
  import optparse
  import sys
  import logging
  import numpy
  from wsgiref.simple_server import make_server
  from wsgiref.util import shift_path_info
  from collections import defaultdict
label_desc: Use image node_id 3 to create a new LanguageIdentifier object from inherited base classes: object with example: obj = LanguageIdentifier(nb_ptc, nb_pc, nb_numfeats, nb_classes, tk_nextmove, tk_output, norm_probs)