langreader
langreader
Generate language-learning HTML readers from Markdown using an LLM.
langreader is a CLI tool that converts Markdown texts into interactive HTML readers. It uses Large Language Models (LLMs) via multiai to split paragraphs into natural sentences and provide sentence-level translations.
π Demo
Before reading further, check out what this tool generates:
π Live Demo: French Reader (Alsace)
Features
- π€ AI-Powered Translation: Automatically splits paragraphs into natural sentences and translates them line-by-line.
- π Text-to-Speech: Built-in audio buttons for every source sentence (uses browser Web Speech API).
- β―οΈ Resumable Generation: Hit an API rate limit? Use
--continueto resume generation exactly where it stopped. - π Markdown Support: Preserves headings, code blocks, and basic formatting.
- π Wikipedia Helper: Includes a script to easily fetch and format Wikipedia articles for learning.
Installation
pip install md-llm-lang-reader
Prerequisite: multiai configuration
This tool uses multiai internally to access LLM providers (OpenAI, Anthropic, Google, etc.).
Before using langreader, you must configure multiai.
Details on supported providers and configuration can be found here: https://sekika.github.io/multiai/
Quick Start
- Prepare a Markdown file (
input.md):# Bonjour Ceci est un exemple de phrase. - Run the command:
langreader -i input.md -o output.html --src fr --tgt en --provider openai --model gpt-4o-mini - Open
output.htmlin your browser.
Documentation Navigation
- Usage Guide: Detailed CLI options, YAML metadata, and styling.
- Tutorial: A step-by-step example creating a French reader from Wikipedia (βAlsaceβ).
- TTS Setup: How to configure voices on Windows, macOS, iOS, and Android.