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: Run language detection on a string, a Document, or a list of either, route to language specific pipeline
docstr_tok: ["Run","language","detection","on","a","string",",","a","Document",",","or","a","list","of","either",",","route","to","language","specific","pipeline"]
code: def process(self, doc):
      """
      Run language detection on a string, a Document, or a list of either, route to language specific pipeline
      """
  
      # only return a list if given a list
      singleton_input = not isinstance(doc, list)
      if singleton_input:
          docs = [doc]
      else:
          docs = doc
  
      if docs and isinstance(docs[0], str):
          docs = [Document([], text=text) for text in docs]
  
      # run language identification
      docs_w_langid = self.lang_id_pipeline.process(docs)
  
      # create language specific batches, store global idx with each doc
      lang_batches = {}
      for doc_idx, doc in enumerate(docs_w_langid):
          logger.debug(
              "Language for document %d: %s", doc_idx, doc.lang
          )
          if doc.lang not in lang_batches:
              lang_batches[doc.lang] = []
          lang_batches[doc.lang].append(doc)
  
      # run through each language, submit a batch to the language specific pipeline
      for lang in lang_batches.keys():
          self._update_pipeline_cache(lang)
          self.pipeline_cache[lang](lang_batches[lang])
  
      # only return a list if given a list
      if singleton_input:
          return docs_w_langid[0]
      else:
          return docs_w_langid
  
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 3 for calling the MultilingualPipeline obj's underlying member method code with example usage: obj.process(doc) and returns: docs_w_langid, docs_w_langid