Signpost AI Logo
WorkersTools

Languagedetection

📸 Screenshots

Here are visual examples of this section:

Languagedetection - Worker Configuration Interface Languagedetection - Worker Configuration Interface

1. Overview and Purpose

The Language Detection worker automatically identifies the language of input text using the franc library. It returns ISO 639-3 language codes and can be configured to detect only specific languages or detect from all supported languages. The worker defaults to English ("eng") when detection fails or no text is provided.

2. Configuration Parameters

The Worker accepts the following parameters:

  • languages: An array of ISO 639-3 language codes to limit detection to specific languages. If empty, detects from all supported languages.

3. Input/Output Handles

  • input: Input handle - accepts text string for language detection
  • language: Output handle - returns the detected ISO 639-3 language code as a string

4. Usage Examples with Code

// Basic language detection for any language
const worker = agent.initializeWorker({
  type: "languageDetection",
  parameters: {
    languages: [] // Detect from all languages
  }
});

// Restrict detection to specific languages
const restrictedWorker = agent.initializeWorker({
  type: "languageDetection", 
  parameters: {
    languages: ["eng", "spa", "fra"] // Only detect English, Spanish, French
  }
});

5. Integration Examples

This worker is commonly used at the beginning of text processing workflows to route content based on language, or before translation workers to identify source languages.

6. Best Practices

  • Use the languages parameter to restrict detection when you know the possible input languages to improve accuracy
  • Provide sufficient text input (minimum 2 characters) for reliable detection
  • Consider the worker returns "eng" as default when detection fails
  • Use ISO 639-3 three-letter language codes in the languages array

7. Troubleshooting Tips

  • If detection returns "eng" unexpectedly, check that input text has sufficient length and content
  • Verify language codes in the languages parameter are valid ISO 639-3 codes
  • Very short text inputs may not provide enough context for accurate detection
  • Mixed-language text will return the most prominent detected language