or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-8/

Encoding Analysis Tool

Build a tool that analyzes text files to identify all possible character encodings with confidence scores. The tool should read a file and return a ranked list of encoding matches.

Capabilities

Analyze file encoding with multiple matches

  • Given a file path "./samples/french.txt" containing French text, the tool returns an array of possible encodings sorted by confidence score in descending order. @test
  • Given a file path "./samples/russian.txt" containing Russian Cyrillic text, the tool returns multiple encoding matches including their confidence scores. @test
  • Given a file path "./samples/japanese.txt" containing Japanese text, the tool identifies at least one encoding match with a confidence score. @test

Return encoding details correctly

  • Each encoding match includes the encoding name as a string and confidence as a number. @test
  • When a file is analyzed, results are sorted by confidence from highest to lowest. @test

Implementation

@generates

API

/**
 * Analyzes a file and returns all possible character encodings
 * sorted by confidence score (highest first).
 *
 * @param filePath - Path to the file to analyze
 * @returns Array of encoding matches with confidence scores
 */
export function analyzeFile(filePath: string): Promise<EncodingMatch[]>;

/**
 * Represents a single encoding match with confidence
 */
export interface EncodingMatch {
  name: string;
  confidence: number;
  lang?: string;
}

/**
 * Main CLI entry point
 */
export function main(): Promise<void>;

Dependencies { .dependencies }

chardet { .dependency }

Provides character encoding detection with detailed confidence scoring for multiple possible encodings.

@satisfied-by