tessl install tessl/pypi-googletrans@4.0.0An unofficial Google Translate API for Python providing free text translation and language detection capabilities
Agent Success
Agent success rate when using this tile
100%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
99%
Build a content analyzer that detects the languages used in text samples and reports language distribution statistics.
Your program should:
@generates
from typing import List, Dict
async def detect_language(text: str) -> Dict[str, any]:
"""
Detects the language of a single text sample.
Args:
text: The text to analyze
Returns:
A dictionary containing:
- 'language': The detected language code
- 'confidence': The confidence score (float between 0 and 1)
- 'text': The original text
"""
pass
async def analyze_batch(texts: List[str]) -> List[Dict[str, any]]:
"""
Analyzes multiple text samples and detects their languages.
Args:
texts: List of text samples to analyze
Returns:
List of dictionaries, each containing language detection results
"""
pass
async def generate_language_stats(texts: List[str]) -> Dict[str, int]:
"""
Generates statistics about language distribution in a collection of texts.
Args:
texts: List of text samples to analyze
Returns:
Dictionary mapping language codes to the count of samples in that language
"""
passProvides language detection capabilities for text analysis.