ูุธุงู
ุฐูู ูุชุญููู ุงูุดุนุฑ ุงูุนุฑุจู
Intelligent Arabic Poetry Analysis System
BAHR (ุจูุญูุฑ, meaning "sea" or "meter" in Arabic) is a comprehensive platform for analyzing and understanding Arabic classical poetry through advanced NLP techniques and prosodic analysis.
โจ The platform is LIVE in production!
- ๐ Try it now: https://frontend-production-6416.up.railway.app/
- ๐ API Documentation: https://backend-production-c17c.up.railway.app/docs
- ๐ Health Status: https://backend-production-c17c.up.railway.app/health
Production Stats:
- โ 98.1% meter detection accuracy
- โ 16 classical Arabic meters supported
- โ Redis caching (5-10x speedup)
- โ 220 passing tests, 99% coverage
- ๐ผ Meter Detection - Automatic identification of Arabic poetic meters (ุงูุจุญูุฑ)
- ๐ Syllable Segmentation - Precise prosodic analysis using CAMeL Tools
- โจ Rhyme Analysis - Pattern extraction and validation
- ๐ RTL-First UI - Beautiful Arabic-first interface with Next.js 16
- ๐ Real-time Analysis - Instant feedback on poetry structure
- ๐ Golden Dataset - 52 annotated classical verses for testing
cd src/frontend
npm install
npm run devVisit: http://localhost:3000
cd src/backend
# Install as editable package (recommended)
pip install -e .
# Or install dependencies directly
pip install -r requirements.txt
# Start server
uvicorn app.main:app --reloadVisit: http://localhost:8000/docs
- Framework: Next.js 16.0.1 with App Router
- Language: TypeScript (strict mode)
- Styling: Tailwind CSS v4
- Components: shadcn/ui (New York style)
- Fonts: Cairo (UI) + Amiri (poetry) via
next/font/google - RTL: Native
dir="rtl"support
- Framework: FastAPI 0.115+
- Language: Python 3.11+
- NLP: CAMeL Tools for Arabic processing
- Database: PostgreSQL 15+ with SQLAlchemy
- Cache: Redis 7+
- Migration: Alembic
- Containerization: Docker + Docker Compose
- CI/CD: GitHub Actions
- Deployment: Railway (backend) + Vercel (frontend)
BAHR/
โโโ src/
โ โโโ backend/ # FastAPI backend
โ โ โโโ app/ # Application code
โ โ โ โโโ api/ # API routes
โ โ โ โโโ core/ # Core prosody engine
โ โ โ โโโ ml/ # ML models & training
โ โ โ โโโ db/ # Database models
โ โ โโโ alembic/ # Database migrations
โ โ โโโ tests/ # Backend unit tests
โ โโโ frontend/ # Next.js 16 frontend
โ โโโ src/
โ โ โโโ app/ # App Router pages
โ โ โโโ components/ # React components
โ โโโ public/ # Static assets
โโโ data/
โ โโโ raw/ # Raw ML datasets (158 JSONL files)
โ โโโ processed/ # Processed datasets & golden set
โ โโโ interim/ # Intermediate processing files
โโโ docs/
โ โโโ api/ # API documentation
โ โโโ research/ # Research documentation
โ โโโ technical/ # Technical specs
โ โโโ deployment/ # Deployment guides
โ โโโ refactor/ # Refactoring documentation
โ โโโ releases/ # Release notes
โโโ results/
โ โโโ ml/ # ML training results
โ โโโ evaluations/ # Model evaluations
โ โโโ diagnostics/ # Analysis outputs
โโโ tests/
โ โโโ integration/ # Integration tests
โโโ scripts/
โ โโโ ml/ # ML training scripts
โ โโโ ml_pipeline/ # ML pipeline & training
โ โโโ tools/ # Development tools
โ โโโ data_processing/ # Data processing scripts
โ โโโ setup/ # Environment setup
โ โโโ refactor/ # Migration scripts
โโโ models/ # Trained ML models
โโโ infrastructure/ # Docker & deployment
โโโ archive/ # Historical documentation
โโโ phases/ # Phase reports
โโโ sessions/ # Session summaries
Note: Repository was refactored on November 14, 2025 for production readiness. Backward compatibility symlinks removed after successful migration. See docs/refactor/ for details.
- ๐ Quick Start Guide - Get up and running in 5 minutes
- ๐ API Documentation - Complete API reference and guides
- ๐๏ธ Technical Specifications - Architecture and implementation details
- ๐ข Deployment Guide - Railway deployment instructions
- ๐ง Refactoring Docs - Repository structure and migration details
- /docs/api/ - API guides and specifications
- /docs/research/ - Research documentation and datasets
- /docs/technical/ - Technical implementation details
- /docs/deployment/ - Deployment and DevOps guides
- /docs/refactor/ - Refactoring documentation
- /archive/ - Historical documentation and phase reports
๐ November 14, 2025 Update: Repository refactored for production readiness.
See docs/refactor/Repo_Refactor_Plan.md for complete details.
๐ PHASE 1 COMPLETE - LIVE IN PRODUCTION!
Phase: All of Phase 1 (Weeks 1-8) โ COMPLETE Progress: 100% of MVP - DEPLOYED TO PRODUCTION Launch Date: November 10, 2025
- Complete technical documentation (40+ files)
- Next.js 16 frontend with RTL + Arabic fonts
- Golden dataset v0.20 (52 annotated verses)
- FastAPI backend with CORS middleware
- Docker Compose configuration (PostgreSQL + Redis)
- CI/CD workflows (GitHub Actions)
- Prosody Engine Core (Week 1-2)
- Text normalization with CAMeL Tools
- Phonetic analysis (CV pattern extraction)
- Taqti3 algorithm (syllable segmentation)
- Bahr detection (4 meters: ุงูุทูููุ ุงููุงู ูุ ุงูุฑู ูุ ุงููุงูุฑ)
- 98.1% accuracy on test dataset โ (exceeds 90% target)
- Database & Infrastructure
- Alembic migrations with 8 performance indexes
- 16 Arabic meters + 8 prosodic feet seeded
- PostgreSQL 15 running in Docker
- Testing & Quality
- 220 passing tests
- 99% code coverage
- Accuracy test suite with golden dataset
- Production Readiness (Week 0)
- Railway CLI installed
- CORS policy configured
- Database indexes documented (ADR-002)
- Railway project setup (CLI ready, need to create project)
- API endpoints implementation (Week 2)
- Frontend-Backend integration
- Production deployment to Railway + Vercel
- Authentication & user management
- Performance optimization
BAHR includes a comprehensive set of shell aliases for common development tasks. To use them:
# Add to your ~/.zshrc
source /Users/YOUR_USERNAME/Desktop/Personal/BAHR/.bahr_aliases.sh
# Reload shell
source ~/.zshrcAvailable commands:
bahr-help- Show all available commandsbahr-setup- Complete environment setupbahr-start/stop/restart- Manage Docker servicesbahr-migrate- Run database migrationsbahr-test- Run tests with coveragebahr-backend/frontend- Start development servers- Plus 30+ more utilities for navigation, testing, and database management
See the full command list by running bahr-help after sourcing the aliases file.
We welcome contributions! See CONTRIBUTING.md for guidelines.
# 1. Fork and clone
git clone https://github.com/YOUR_USERNAME/BAHR.git
cd BAHR
# 2. Create feature branch
git checkout -b feature/your-feature-name
# 3. Make changes and test
npm test # Frontend tests
pytest # Backend tests
# 4. Commit and push
git commit -m "feat: add your feature"
git push origin feature/your-feature-name
# 5. Create Pull RequestThe project includes a Golden Dataset of 42 manually annotated classical Arabic verses:
- โ Schema-validated JSONL format
- โ Prosodic annotations (meters, feet, rhymes)
- โ Metadata (poet, era, source)
- โ Quality assurance reports
See dataset/evaluation/README.md
- ๐ JWT-based authentication
- ๐ก๏ธ OWASP Top 10 compliance
- ๐ Secrets management via Railway/Vercel
- ๐ซ Rate limiting & DDoS protection
See docs/technical/SECURITY.md
This project is licensed under the MIT License - see LICENSE file for details.
- CAMeL Tools - Arabic NLP toolkit
- shadcn/ui - Beautiful UI components
- Next.js Team - Amazing React framework
- FastAPI - High-performance Python framework
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with โค๏ธ for Arabic Poetry Enthusiasts
โญ Star us on GitHub | ๐ Read the Docs | ๐ Report Bug
ุจูุญูุฑ ูู ู ูุตุฉ ุดุงู ูุฉ ูุชุญููู ูููู ุงูุดุนุฑ ุงูุนุฑุจู ุงูููุงุณููู ู ู ุฎูุงู ุชูููุงุช ู ุนุงูุฌุฉ ุงููุบุงุช ุงูุทุจูุนูุฉ ุงูู ุชูุฏู ุฉ ูุงูุชุญููู ุงูุนุฑูุถู.
- ๐ผ ูุดู ุงูุจุญูุฑ ุงูุดุนุฑูุฉ - ุชุญุฏูุฏ ุชููุงุฆู ููุฃูุฒุงู ุงูุนุฑูุถูุฉ
- ๐ ุงูุชูุทูุน ุงูุนุฑูุถู - ุชุญููู ุฏููู ููู ูุงุทุน ุงูุตูุชูุฉ
- โจ ุชุญููู ุงูููุงูู - ุงุณุชุฎุฑุงุฌ ูุงูุชุญูู ู ู ุฃูู ุงุท ุงููุงููุฉ
- ๐ ูุงุฌูุฉ ุนุฑุจูุฉ ุฃุตููุฉ - ุชุตู ูู ุฌู ูู ูุฏุนู ุงูุนุฑุจูุฉ ุจุงููุงู ู
- ๐ ุชุญููู ููุฑู - ุฑุฏูุฏ ูุนู ู ุจุงุดุฑุฉ ุนูู ุจููุฉ ุงููุตูุฏุฉ
- ๐ ู ุฌู ูุนุฉ ุจูุงูุงุช ุฐูุจูุฉ - 42 ุจูุชูุง ููุงุณููููุง ู ูุดูุฑููุญูุง
# ุงููุงุฌูุฉ ุงูุฃู
ุงู
ูุฉ
cd frontend && npm install && npm run dev
# ุงูุฎูููุฉ (ูุฑูุจูุง)
cd backend && pip install -r requirements.txtุงูู
ุฑุญูุฉ: ุงูู
ุฑุญูุฉ 0 ู
ูุชู
ูุฉ โ
ุงูุชูุฏู
: 60%
- โ ุงูุชูุซูู ุงููุงู ู
- โ ุงููุงุฌูุฉ ุงูุฃู ุงู ูุฉ (Next.js 16)
- โ ู ุฌู ูุนุฉ ุงูุจูุงูุงุช ุงูุฐูุจูุฉ
- ๐ ุชุทููุฑ ุงูุฎูููุฉ (ุงูุฃุณุจูุน 1)
ุตููุน ุจุญุจ โค๏ธ ูุนุดุงู ุงูุดุนุฑ ุงูุนุฑุจู