class_docstr: Pipeline for handling multilingual data. Takes in text, detects language, and routes request to pipeline for that
  language.
  
  You can specify options to individual language pipelines with the lang_configs field.
  For example, if you want English pipelines to have NER, but want to turn that off for French, you can do:
      lang_configs = {"en": {"processors": "tokenize,pos,lemma,depparse,ner"},
                      "fr": {"processors": "tokenize,pos,lemma,depparse"}}
      pipeline = MultilingualPipeline(lang_configs=lang_configs)
  
  You can also pass in a defaultdict created in such a way that it provides default parameters for each language.
  For example, in order to only get tokenization for each language:
  (remembering that the Pipeline will automagically add MWT to a language which uses MWT):
      from collections import defaultdict
      lang_configs = defaultdict(lambda: dict(processors="tokenize"))
      pipeline = MultilingualPipeline(lang_configs=lang_configs)
  
  download_method can be set as in Pipeline to turn off downloading
    of the .json config or turn off downloading of everything
docstr: Do any necessary updates to the pipeline cache for this language. This includes building a new
  pipeline for the lang, and possibly clearing out a language with the old last access date.
docstr_tok: ["Do","any","necessary","updates","to","the","pipeline","cache","for","this","language",".","This","includes","building","a","new","pipeline","for","the","lang",",","and","possibly","clearing","out","a","language","with","the","old","last","access","date","."]
code: def _update_pipeline_cache(self, lang):
      """
      Do any necessary updates to the pipeline cache for this language. This includes building a new
      pipeline for the lang, and possibly clearing out a language with the old last access date.
      """
  
      # update request history
      if lang in self.pipeline_cache:
          self.pipeline_cache.move_to_end(lang, last=True)
  
      # update language configs
      # try/except to allow for a defaultdict
      try:
          lang_config = self.lang_configs[lang]
      except KeyError:
          lang_config = {"lang": lang}
          self.lang_configs[lang] = lang_config
  
      # if a defaultdict is passed in, the defaultdict might not contain 'lang'
      # so even though we tried adding 'lang' in the constructor, we'll check again here
      if "lang" not in lang_config:
          lang_config["lang"] = lang
  
      if "download_method" not in lang_config:
          lang_config["download_method"] = self.download_method
  
      if "processors" not in lang_config:
          if self.default_processors:
              lang_resources = get_language_resources(
                  self.resources, lang
              )
              lang_processors = [
                  x
                  for x in self.default_processors
                  if x in lang_resources
              ]
              if lang_processors != self.default_processors:
                  logger.info(
                      "Not all requested processors %s available for %s.  Loading %s instead",
                      self.default_processors,
                      lang,
                      lang_processors,
                  )
              lang_config["processors"] = ",".join(lang_processors)
  
      # update pipeline cache
      if lang not in self.pipeline_cache:
          logger.debug(
              "Loading unknown language in MultilingualPipeline: %s",
              lang,
          )
          # clear least recently used lang from pipeline cache
          if len(self.pipeline_cache) == self.max_cache_size:
              self.pipeline_cache.popitem(last=False)
          self.pipeline_cache[lang] = Pipeline(
              dir=self.model_dir,
              device=self.device,
              **self.lang_configs[lang],
          )
  
file_path: stanza/stanza/pipeline/multilingual.py
imports: from collections import OrderedDict
  import copy
  import logging
  from typing import Union
  from stanza.models.common.doc import Document
  from stanza.models.common.utils import default_device
  from stanza.pipeline.core import Pipeline, DownloadMethod
  from stanza.pipeline._constants import *
  from stanza.resources.common import DEFAULT_MODEL_DIR, get_language_resources, load_resources_json
label_desc: Use image node_id 2 for calling the MultilingualPipeline obj's underlying member method code with example usage: obj._update_pipeline_cache(lang) without return types