| title |
Text translation |
| nextjs |
| metadata |
| title |
description |
Text translation |
Learn about text translation. |
|
|
LLMs have proven their proficiency in translation tasks. To leverage this capability, Scikit-LLM provides the Translator module, designed for translating any given text into a specified target language.
Example:
from skllm.models.gpt.text2text.translation import GPTTranslator
from skllm.datasets import get_translation_dataset
X = get_translation_dataset()
t = GPTTranslator(model="gpt-3.5-turbo", output_language="English")
translated_text = t.fit_transform(X)
The following API reference only lists the parameters needed for the initialization of the estimator. The remaining methods follow the syntax of a scikit-learn transformer.
from skllm.models.gpt.text2text.translation import GPTTranslator
| Parameter |
Type |
Description |
model |
str |
Model to use, by default "gpt-3.5-turbo". |
key |
Optional[str] |
Estimator-specific API key; if None, retrieved from the global config, by default None. |
org |
Optional[str] |
Estimator-specific ORG key; if None, retrieved from the global config, by default None. |
output_language |
str |
Target language, by default "English". |
from skllm.models.anthropic.text2text.translation import ClaudeTranslator
| Parameter |
Type |
Description |
model |
str |
Model to use, by default "claude-3-haiku-20240307" |
key |
Optional[str] |
Estimator-specific API key; if None, retrieved from the global config, by default None |
output_language |
str |
Target language, by default "English" |