class_docstr: Routes a text input onto one of different output connections depending on its language.
  This is useful for routing queries to different models in a pipeline depending on their language.
  The set of supported languages can be specified.
  For routing Documents based on their language use the related DocumentLanguageClassifier component to first
  classify the documents and then the MetaDataRouter to route them.
  
  Example usage in a retrieval pipeline that passes only English language queries to the retriever:
  
  ```python
  document_store = InMemoryDocumentStore()
  p = Pipeline()
  p.add_component(instance=TextLanguageRouter(), name="text_language_router")
  p.add_component(instance=InMemoryBM25Retriever(document_store=document_store), name="retriever")
  p.connect("text_language_router.en", "retriever.query")
  p.run({"text_language_router": {"text": "What's your query?"}})
  ```
docstr: Run the TextLanguageRouter. This method routes the text one of different edges based on its language.
  If the text does not match any of the languages specified at initialization, it is routed to
  a connection named "unmatched".
  
  :param text: A str to route to one of different edges.
docstr_tok: ["Run","the","TextLanguageRouter",".","This","method","routes","the","text","one","of","different","edges","based","on","its","language",".","If","the","text","does","not","match","any","of","the","languages","specified","at","initialization",",","it","is","routed","to","a","connection","named","``","unmatched","''",".",":","param","text",":","A","str","to","route","to","one","of","different","edges","."]
code: def run(self, text: str) -> Dict[str, str]:
      """
      Run the TextLanguageRouter. This method routes the text one of different edges based on its language.
      If the text does not match any of the languages specified at initialization, it is routed to
      a connection named "unmatched".
  
      :param text: A str to route to one of different edges.
      """
      if not isinstance(text, str):
          raise TypeError(
              "TextLanguageRouter expects a str as input. In case you want to classify a document, please use the DocumentLanguageClassifier and MetaDataRouter."
          )
  
      output: Dict[str, str] = {}
  
      detected_language = self.detect_language(text)
      if detected_language in self.languages:
          output[detected_language] = text
      else:
          output["unmatched"] = text
  
      return output
  
imports: import logging
  from typing import List, Dict, Optional
  from haystack import component
  from haystack.lazy_imports import LazyImport
label_desc: Use image node_id 2 for calling the TextLanguageRouter obj's underlying member method code with example usage: obj.run(text) and returns: output