An unofficial Google Translate API for Python providing free text translation and language detection capabilities
Overall
score
100%
Evaluation — 100%
↑ 1.01xAgent success when using this tile
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.
Install with Tessl CLI
npx tessl i tessl/pypi-googletrans@4.0.0docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10