Polyglot is an adaptive language learning application powered by large language models that provides personalized tutoring based on the user's target language and proficiency level (A1-C1). It offers translations, grammar explanations, vocabulary exercises, and supports learning from various file formats according to learner's current CEFR level.
- Dynamic Context Understanding: Uses Large Language Models to understand the nuances of user requests
- Intelligent Topic Detection: Automatically identifies language learning topics in user queries
- Language Detection: Recognizes the language of text with high accuracy
- Content Analysis: Analyzes uploaded files to extract relevant learning materials
- Languages: Support for multiple languages including Finnish, Spanish, French, German, Russian, and more
- Easy Language Switching: Change target language with persistent progress tracking
- Native Greetings: Time-of-day appropriate greetings in the target language
- Adaptive Content: All materials dynamically adjusted to CEFR levels (A1, A2, B1, B2, C1)
- Visual Level Indicators: Clear badges showing current proficiency level
- Progress Tracking: Records level changes across different languages
- Level-Appropriate Guidelines: LLM-generated grammar and vocabulary guidelines for each level
- Translations: Between target language and English with grammar explanations
- Grammar Breakdowns: Detailed explanations with visual aids
- Vocabulary Building: Level-appropriate word lists
- Reading and Writing Exercises: Generated based on current proficiency
- Interactive Quizzes: With immediate feedback
- Text Processing: Extract learning content from uploaded documents
- Image Analysis: Learn from uploaded images containing text in the target language
- File Content Analysis: LLM-powered analysis of file contents for relevant learning material
- Topic Tracking: Identifies user interests to provide relevant examples
- Learning History: Exportable chat history with level indicators
- Exercise Parameter Detection: Understands implicit and explicit exercise requests
Polyglot uses a modern technical stack with:
- Streamlit: For the responsive web interface
- LangChain: To integrate with large language models
- OpenAI API: Powering the intelligent language tutoring
- Function Caching: For performance optimization
- Real-time Content Generation: Streaming responses for better user experience
The application is structured into three main modules:
- app.py: Main application interface and user interaction
- chatbot.py: LLM integration and conversation management
- utils.py: LLM-powered utility functions for language learning
- Python 3.8 or higher
- OpenAI API key
git clone https://github.com/yourusername/language-app.git
cd language-appcurl -LsSf https://astral.sh/uv/install.sh | shuv syncCreate a .streamlit/secrets.toml file in your project directory:
mkdir -p .streamlit
touch .streamlit/secrets.tomlEdit the secrets.toml file and add your OpenAI API key:
OPENAI_API_KEY = "your-api-key-here"
MODEL_NAME = "gpt-4.1-mini-2025-04-14" # Optional - change modeluv run streamlit run app.pyChoose from 15+ supported languages in the sidebar dropdown.
Choose your CEFR level (A1-C1) from the sidebar to ensure all content is appropriate for your current proficiency.
- Type
T: [text]to translate text between your target language and English - Ask grammar questions like "Explain verb conjugation" or "How do possessives work?"
- Request vocabulary on specific topics: "Vocabulary about food in Spanish"
- Ask for level-appropriate exercises: "Give me a reading exercise about hobbies"
- Try writing exercises: "Create a writing exercise about daily routines"
- Test yourself with quizzes: "Quiz me on basic verbs"
- Upload images containing text in your target language
- Upload text documents with content in your target language
- Polyglot will analyze the content, provide translations, and create exercises based on the material
- Reset the conversation at any time using the sidebar button
- Export your chat history as a Markdown file for later review
- Track your level progression in the sidebar for each language
Polyglot replaces traditional rule-based NLP with contextual LLM intelligence for:
- Topic Extraction: Identifies learning topics in user messages
- Exercise Parameter Detection: Understands the type of exercise requested
- Language Detection: Identifies the language of text segments
- Content Guidelines: Generates appropriate vocabulary and grammar for each level
- File Content Analysis: Assesses the difficulty level and extracts learning material
The application optimizes the learning experience by:
- Level-Specific Content: Dynamically generating level-appropriate content
- Personalized Examples: Using detected topics to create relevant examples
- Progress Tracking: Monitoring level changes to provide appropriate review
- File Analysis: Determining if uploaded content matches the learner's level
To add support for new languages:
- Add the language to the
SUPPORTED_LANGUAGESdictionary inapp.py - Add appropriate greetings to the
LANGUAGE_GREETINGSdictionary - Add grammar features to
get_language_grammar_features()inutils.py - Add CEFR level guidelines to
get_cefr_level_guidelines()inchatbot.py - Add level-appropriate content to
get_level_appropriate_content()inutils.py
The modular architecture makes it easy to add new features:
- UI components can be added to
app.py - LLM-based processing can be extended in
chatbot.py - Utility functions can be added to
utils.py
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Common European Framework of Reference for Languages (CEFR) for level guidelines
- Streamlit for the interactive web application framework
- OpenAI and LangChain for the underlying language model integration