TextLanguageRouter
Routes text strings to different output connections based on their language.
Basic Information
- Type:
haystack_integrations.routers.text_language_router.TextLanguageRouter
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| text | str | A text string to route. |
Outputs
| Parameter | Type | Default | Description |
|---|
Overview
Bear with us while we're working on adding pipeline examples and most common components connections.
Routes text strings to different output connections based on their language.
Provide a list of languages during initialization. If the document's text doesn't match any of the specified languages, the metadata value is set to "unmatched". For routing documents based on their language, use the DocumentLanguageClassifier component, followed by the MetaDataRouter.
Usage Example
components:
TextLanguageRouter:
type: components.routers.text_language_router.TextLanguageRouter
init_parameters:
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| languages | Optional[List[str]] | None | A list of ISO language codes. See the supported languages in langdetect documentation. If not specified, defaults to ["en"]. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
| text | str | A text string to route. |
Was this page helpful?