class_docstr: Classify the language of documents and add the detected language to their metadata.
  A MetadataRouter can then route them onto different output connections depending on their language.
  This is useful to route documents to different models in a pipeline depending on their language.
  The set of supported languages can be specified.
  For routing plain text using the same logic, use the related TextLanguageRouter component instead.
  
  Example usage within an indexing pipeline, storing in a Document Store
  only documents written in English:
  
  ```python
  document_store = InMemoryDocumentStore()
  p = Pipeline()
  p.add_component(instance=TextFileToDocument(), name="text_file_converter")
  p.add_component(instance=DocumentLanguageClassifier(), name="language_classifier")
  p.add_component(instance=MetadataRouter(rules={"en": {"language": {"$eq": "en"}}}), name="router")
  p.add_component(instance=DocumentWriter(document_store=document_store), name="writer")
  p.connect("text_file_converter.documents", "language_classifier.documents")
  p.connect("language_classifier.documents", "router.documents")
  p.connect("router.en", "writer.documents")
  ```
docstr: Run the DocumentLanguageClassifier. This method classifies the documents' language and adds it to their metadata.
  If a Document's text does not match any of the languages specified at initialization, the metadata value "unmatched" will be stored.
  
  :param documents: A list of documents to classify their language.
  :return: List of Documents with an added metadata field called language.
docstr_tok: ["Run","the","DocumentLanguageClassifier",".","This","method","classifies","the","documents","'","language","and","adds","it","to","their","metadata",".","If","a","Document","'s","text","does","not","match","any","of","the","languages","specified","at","initialization",",","the","metadata","value","``","unmatched","''","will","be","stored",".",":","param","documents",":","A","list","of","documents","to","classify","their","language",".",":","return",":","List","of","Documents","with","an","added","metadata","field","called","language","."]
code: def run(self, documents: List[Document]):
      """
      Run the DocumentLanguageClassifier. This method classifies the documents' language and adds it to their metadata.
      If a Document's text does not match any of the languages specified at initialization, the metadata value "unmatched" will be stored.
  
      :param documents: A list of documents to classify their language.
      :return: List of Documents with an added metadata field called language.
      """
      if (
          not isinstance(documents, list)
          or documents
          and not isinstance(documents[0], Document)
      ):
          raise TypeError(
              "DocumentLanguageClassifier expects a list of Document as input. "
              "In case you want to classify a text, please use the TextLanguageClassifier."
          )
  
      output: Dict[str, List[Document]] = {
          language: [] for language in self.languages
      }
      output["unmatched"] = []
  
      for document in documents:
          detected_language = self.detect_language(document)
          if detected_language in self.languages:
              document.meta["language"] = detected_language
          else:
              document.meta["language"] = "unmatched"
  
      return {"documents": documents}
  
imports: import logging
  from typing import List, Dict, Optional
  from haystack import component, Document
  from haystack.lazy_imports import LazyImport
label_desc: Use image node_id 2 for calling the DocumentLanguageClassifier obj's underlying member method code with example usage: obj.run(documents) and returns: dict