class_docstr: This class implements the actual language identifier.
class_docstr_tok: ["This","class","implements","the","actual","language","identifier","."]
code: def set_languages(self, langs=None):
      logger.debug("restricting languages to: %s", langs)
  
      # Unpack the full original model. This is needed in case the language set
      # has been previously trimmed, and the new set is not a subset of the current
      # set.
      nb_ptc, nb_pc, nb_classes = self.__full_model
  
      if langs is None:
          self.nb_classes = nb_classes
          self.nb_ptc = nb_ptc
          self.nb_pc = nb_pc
  
      else:
          # We were passed a restricted set of languages. Trim the arrays accordingly
          # to speed up processing.
          for lang in langs:
              if lang not in nb_classes:
                  raise ValueError("Unknown language code %s" % lang)
  
          subset_mask = np.fromiter(
              (l in langs for l in nb_classes), dtype=bool
          )
          self.nb_classes = [c for c in nb_classes if c in langs]
          self.nb_ptc = nb_ptc[:, subset_mask]
          self.nb_pc = nb_pc[subset_mask]
  
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 4 for calling the LanguageIdentifier obj's underlying member method code with example usage: obj.set_languages(langs) without return types