Detect language
Detect
Detect the source language of a sentence or of a set of sentences. It's possible to specify a hint and a pass list to refine the result of the detection.
Request
res = lara.detect('Hello, how are you?',
hint='en',
passlist=['en', 'fr', 'it']
)
print(res.language)const res = await lara.detect('Hello, how are you?', 'en', ['en', 'fr', 'it');
console.log(res.language);
DetectResult res = lara.detect("Hello, how are you?", "en", {"en", "fr", "it"});$res = $lara->detect('Hello, how are you?', 'en', array('en', 'fr', 'it');res, _ := lara.Detect("Hello, how are you?", "en", []string{"en", "fr", "it})
fmt.Println(*res.Language.String)val res: DetectResult = lara.detect(
"Hello, how are you?",
"en",
{"en", "fr", "it"}
)var res = await lara.Detect(
"Hello, how are you?", "en", new[] { "en", "fr", "it" });let res = try await lara.detect(text: "Hello, how are you?", hint: "en", passlist: ["en", "fr", "it"])Here follows the basic fields for the detect method:
Field | Type | Required | Default | Description |
|---|---|---|---|---|
text | String | | Yes | The text to be detected. This can be a single string or a list (up to 128 elements) of strings. | |
hint | String | No | An hint for the source language code (e.g., "en-US" for English). | |
passlist | String[] | No | A list of language codes. If specified, the result will be restricted to this set. |
The result of the detect method is an object containing:
| Field | Type | Description |
|---|---|---|
| language | String | The detected language |
| content_type | String | The detected content type |
Prices per 1M characters
| Service | Free | Pro | Team |
|---|---|---|---|
| Language Identifier | - | € 2 | € 1.5 |
Updated about 18 hours ago
