https://github.com/aldrees7/language-companion
Streamlit-based AI Language Tutor β explain grammar, translate text, generate quizzes, and run SRS reviews with memory persistence. Built with OpenAI + Python.
https://github.com/aldrees7/language-companion
ai education langchain language-learning nlp openai python srs streamlit tutor
Last synced: about 2 months ago
JSON representation
Streamlit-based AI Language Tutor β explain grammar, translate text, generate quizzes, and run SRS reviews with memory persistence. Built with OpenAI + Python.
- Host: GitHub
- URL: https://github.com/aldrees7/language-companion
- Owner: Aldrees7
- Created: 2025-11-02T17:18:37.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-11-02T18:00:14.000Z (8 months ago)
- Last Synced: 2025-11-02T20:11:32.407Z (8 months ago)
- Topics: ai, education, langchain, language-learning, nlp, openai, python, srs, streamlit, tutor
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π§βπ« Language Companion
**An AI-powered study partner for language learners.**
Paste any lesson or upload files to explain, translate, analyze grammar, generate quizzes, extract vocabulary, and build review notes with spaced-repetition tracking.
---
## π Quick Start
### 1οΈβ£ Install dependencies
```bash
uv venv
uv sync
```
### 2οΈβ£ Set your API key
```bash
# PowerShell
$env:OPENAI_API_KEY="sk-..."
# or Linux/Mac
export OPENAI_API_KEY="sk-..."
```
### 3οΈβ£ Launch the app
```bash
uv run streamlit run src/app/app.py
```
---
## β¨ Features
### π§© Core Modes
| Mode | Description |
|-------|--------------|
| **Explain** | Simplifies and paraphrases text for A2/B1 learners. |
| **Translate** | Produces a natural, fluent English translation. |
| **Grammar** | Highlights key grammar points and examples. |
| **Quiz** | Generates 10 mixed question types (MCQ, cloze, meaning). |
| **Vocab** | Extracts 10β12 key words/phrases with examples. |
---
### π§Ύ Review Note Formats
| Format | Output Style | Use Case |
|---------|---------------|----------|
| **Study Sheet** | Structured sections (TL;DR, Grammar, Vocab, Drills). | Print-style learning notes. |
| **Flashcards** | `Q:` / `A:` pairs. | Self-testing or Anki import. |
| **Compact** | 1-line bullets for quick review. | Mobile or smartwatch notes. |
---
### πΎ Spaced Repetition System (SRS)
- Vocabulary cards saved locally in `src/data/srs_db.json`.
- Grading buttons adjust review schedule:
- **Again:** soon (reset)
- **Hard:** shorter delay
- **Good:** normal delay
- **Easy:** longer delay
- Persistent storage β all progress is saved between sessions.
---
### π File Support
Supports `.txt`, `.md`, `.pdf`, and `.docx` uploads.
Automatically extracts text using **PyMuPDF** (for PDFs) and **python-docx** (for Word files).
---
## π§ Architecture Overview
```
src/
ββ app/
β ββ app.py # Streamlit UI
ββ agent_core/
β ββ agent.py # LangChain logic and prompts
β ββ prompts/system.json # Base system prompt
ββ utils/
β ββ constants.py # Configuration values
β ββ storage.py # Local JSON persistence
β ββ srs.py # Spaced repetition scheduler
ββ data/
ββ srs_db.json # Local SRS deck
```
---
## π§© Tech Stack
| Component | Library |
|------------|----------|
| **Frontend** | Streamlit |
| **LLM / Agents** | LangChain + OpenAI (GPT-4o-mini) |
| **Data Handling** | JSON (local storage) |
| **PDF & Word Parsing** | PyMuPDF, python-docx |
| **Code Quality** | Ruff + Black |
| **Dependency Management** | uv |
---
## π§ Constants & Config
All static configuration lives in `src/utils/constants.py` β including:
- model (`OPENAI_MODEL`)
- SRS intervals
- review batch size
- upload limits
- paths for data and review notes
---
## π§ͺ Example Usage
Upload a file or paste text such as:
```
Anna steht frΓΌh auf und geht in das kleine CafΓ© an der Ecke.
Sie bestellt einen Kaffee mit Milch und ein BrΓΆtchen mit Marmelade.
```
Then choose:
- Mode β **Explain**
- Review Note Format β **Study Sheet**
- Click **Analyze** or **π Make Review Note**
---
## π Project Status
β
Functional & stable prototype.
π‘ Optional future upgrades:
- Deck statistics in sidebar.
- Lesson history viewer.
- Cloud sync for user data.
---
## βοΈ License
MIT License Β© 2025 Language Companion Developers