Transform raw customer text into structured engineering documents β powered by NLP and LLM intelligence.
- About the Project
- Key Features
- Architecture
- Performance Metrics
- Tech Stack
- Installation
- Usage
- Project Structure
- Outputs
- Testing
- Roadmap
- Contributing
- License
Requirements engineering is one of the most challenging and time-consuming phases in software development. Ambiguous customer language, missed edge cases, and contradictory statements can derail entire projects before a single line of code is written. Industry research consistently attributes ~40% of project failures to poor requirements documentation.
AutoReq solves this by combining classical NLP (Stanza) for fast structural analysis with Large Language Models (Gemini 2.5 Flash via OpenRouter) for deep semantic reasoning β creating a hybrid AI pipeline that converts unstructured Turkish customer text into professionally structured, industry-standard documentation.
"Better software starts with better requirements."
- π Save hours of manual requirements elicitation and documentation
- π― Catch conflicts between requirements with 96.1% F1 score
- π Generate ISO 29148-compliant SRS documents automatically
- π§ͺ Produce test artifacts β BDD scenarios, user stories, and sprint backlogs
- π Turkish language native β built specifically for agglutinative Turkish morphology
- π KVKK compliant β personal data masking before LLM processing
- Text Preprocessing β Sentence-level tokenization, stopword removal, and lemmatization using Stanza Turkish pipeline
- KVKK Data Masking β Auto-masks Turkish ID numbers (
[TC_KIMLIK_NO]) and personal names ([KISI_ADI]) before LLM processing, with sentence-start analysis and exclusion lists to prevent false positives - Hybrid FR/NFR Classification β 3-layer approach: (1) Turkish verb suffix detection (regex), (2) NFR keyword matching (55+ terms), (3) LLM few-shot fallback for ambiguous cases β 94.7% accuracy
- Actor & Object Extraction β Multi-layer NER: lemma table (80+ actor lemmas), dependency parsing (
nsubj/nsubj:pass), SOV syntactic patterns, and multi-word actor detection (18 bigram labels) β 86.5% F1 score - Priority Detection β Rule-based priority scoring with negation detection and compound pattern exclusion
- Conflict Detection β Pairwise analysis identifying contradictions across 6 categories (logic, business rule, performance, security, usability, other) with natural language explanations β 96.1% F1 score
- Gap Analysis β Domain-aware detection of missing requirements using configurable checklists (e.g., login flow exists but password reset is missing), with confidence scoring and deduplication
- Requirement Improvement β Transforms vague statements like "should be fast" into measurable, testable criteria with 35+ Turkish/English vague keyword detection and batch LLM processing
- SRS Generator β Produces dynamic, data-driven ISO/IEC/IEEE 29148 compliant SRS documents (PDF) with 11 sections populated from actual analysis data, including functional/NFR tables, actors, data objects, and detected conflicts
- User Stories β Generates Agile stories in "Bir [rol] olarak, [fayda] amacΔ±yla [hedef] istiyorum" format with acceptance criteria, exported as DOCX
- BDD Scenarios β Creates Gherkin-format Given-When-Then test scenarios (happy path + negative) under a unified
Feature:block, exported as.featurefiles - Product Backlog β Prioritized sprint backlog with Fibonacci story points, conflict-weighted scoring, and XLSX export with styled headers
- Streamlit-based UI β 4-page navigation: Input β Analysis β Results β Export
- Light/Dark Mode β Full CSS theming with localStorage persistence
- i18n Support β Turkish and English interface localization
- Demo Mode β 6 pre-loaded domain scenarios (e-commerce, banking, education, healthcare, corporate, mobile)
- Real-time Metrics β Sidebar showing API status, token usage, cost tracking, and requirement/conflict/gap counts
- Rich Components β Requirement cards, conflict cards, gap cards, diff views, badges, and step indicators
AutoReq follows a 3-layer pipeline architecture with parallel execution:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β app.py (Orchestrator) β
β Streamlit 4-Page Dashboard β
ββββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ€
β Layer 1 β Layer 2 β Layer 3 β
β core/ β modules/ β outputs/ β
β β β β
β TextPreprocessor β ConflictDetector β SRS Generator (PDF) β
β Classifier (3L) β GapAnalyzer β Story Generator (DOCX) β
β EntityRecognizer β Req. Improver β BDD Generator (.feature) β
β PriorityDetector β LLM Client β Backlog Generator (XLSX) β
β KVKK Masking β Prompt Cache β Exporters (JSON/XLSX/DOCX) β
β Models (Pydantic)β β β
ββββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββ
ββββ TextPreprocessor (Stanza) βββ Sentence Segmentation
β β
Raw Text ββββββββββββ€ ββββββ΄βββββ
β Classifier NER
β (3-layer) (3-layer)
β ββββββ¬βββββ
β βΌ
β ParsedDocument
β β
β βββββββββββββββββββββββββββΌββββββββββββββββ
β β RequirementImprover β β
β β (sequential, first) β β
β ββββββββββββββ¬βββββββββββββ β
β βΌ β
β ββββββββββββββ΄βββββββββββββ β
β β ThreadPoolExecutor β β
β β ββββββββββββββββββββ β β
β β β ConflictDetector β β β
β β β GapAnalyzer β β β
β β ββββββββββββββββββββ β β
β ββββββββββββββ¬βββββββββββββ β
β βΌ β
β AnalysisReport β
β β β
β ββββββββββββββ΄βββββββββββββ β
β β ThreadPoolExecutor β β
β β (5 parallel workers) β β
β β ββββββββββββββββββββ β β
β β β SRS PDF β β β
β β β Backlog XLSX β β β
β β β User Stories DOCX β β β
β β β BDD .feature β β β
β β β JSON Report β β β
β β ββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Pattern | Purpose |
|---|---|
| Pipeline / Chain | Sequential text processing across NLP stages |
| Singleton (Memoized) | Heavy NLP models loaded once via @st.cache_resource |
| DTO (Pydantic v2) | Requirement β ParsedDocument β AnalysisReport data flow with validation |
| Strategy | Interchangeable prompt templates for each LLM task |
| Facade | LLMClient hides OpenRouter/Gemini/DeepSeek API specifics |
| Graceful Degradation | Pipeline continues with NLP-only results if LLM unavailable |
| Dependency Injection | LLM client injected into all analyzers for testability |
| Parallel Execution | ThreadPoolExecutor for concurrent analysis and output generation |
Evaluated on 3 independent datasets:
| Metric | Dev Corpus (244 sentences, 8 domains) | Held-out Corpus (113 sentences, 2 new domains) | Conflict Dataset (153 sentences, 50 conflict pairs) |
|---|---|---|---|
| FR/NFR Classification | 94.7% accuracy | 87.6% accuracy | β |
| Actor Extraction β Precision | 92.4% | 61.9% | β |
| Actor Extraction β Recall | 81.2% | 41.9% | β |
| Actor Extraction β F1 | 86.5% | 50.0% | β |
| Conflict Detection β Precision | β | β | 94.2% |
| Conflict Detection β Recall | β | β | 98.0% |
| Conflict Detection β F1 | β | β | 96.1% |
Note: Held-out corpus covers healthcare and automotive (autonomous driving) domains never seen during development. The drop in actor extraction F1 (50.0%) reflects limitations of rule-based NER with unseen technical terminology β future work targets transformer-based NER integration.
| Layer | Technology | Purpose |
|---|---|---|
| Language | Python 3.8+ | Core runtime |
| NLP Engine | Stanza 1.11 | Tokenization, POS tagging, lemmatization, dependency parsing |
| LLM | Gemini 2.5 Flash (via OpenRouter) | Conflict detection, gap analysis, improvement, story/BDD generation |
| LLM Fallback | Google Gemini API β DeepSeek API | Triple-fallback chain for reliability |
| Web UI | Streamlit 1.57 | 4-page interactive dashboard with i18n |
| PDF Export | fpdf2 2.8 | ISO 29148 SRS document generation with Turkish font support |
| XLSX Export | openpyxl 3.1 | Styled Product Backlog spreadsheets |
| DOCX Export | python-docx 1.2 | User Stories with formatted acceptance criteria |
| Data Models | Pydantic v2 | Type-safe schema validation with validate_assignment |
| Logging | Loguru | Structured logging with module binding |
| Testing | pytest 9.0 + syrupy | Unit, integration, regression, and snapshot testing |
| VCS | Git + GitHub | Scrum-based agile workflow |
- Python 3.8 or higher
- pip package manager
- Git
# 1οΈβ£ Clone the repository
git clone https://github.com/AutoReq-DevTeam/AutoReq.git
cd AutoReq
# 2οΈβ£ Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # Linux / macOS
venv\Scripts\activate # Windows
# 3οΈβ£ Install dependencies
pip install -r requirements.txt
# 4οΈβ£ Download the Stanza Turkish NLP model (~150 MB)
python -c "import stanza; stanza.download('tr')"
# 5οΈβ£ Configure environment variables
cp .env.example .env # Linux / macOS
copy .env.example .env # WindowsCreate a .env file from the provided template and configure:
| Variable | Required | Default | Description |
|---|---|---|---|
OPENROUTER_API_KEY |
β Yes (for LLM features) | β | Your OpenRouter API key (get one here) |
GEMINI_API_KEY |
β No (fallback) | β | Google AI Studio API key (used as fallback if OpenRouter fails) |
DEEPSEEK_API_KEY |
β No (fallback) | β | DeepSeek API key (used as secondary fallback) |
π‘ Note: The core NLP pipeline (preprocessing, classification, NER, priority detection) works without any API key. Only LLM-powered features (conflict detection, gap analysis, requirement improvement, story/BDD generation) require
OPENROUTER_API_KEY.
streamlit run app.pyThe Streamlit dashboard will open automatically at http://localhost:8501.
- Input β Paste your raw requirements text or select a demo scenario (6 domains available)
- Analyze β Click the "Analyze" button; the pipeline processes text through all 3 layers
- Review β Explore results across tabbed panels:
- π Requirements β Classified list with FR/NFR labels, actors, objects, and priorities
β οΈ Conflicts β Detected contradictions with severity and natural language explanations- π Gaps β Missing requirements with suggestions and confidence scores
- β¨ Improvements β Side-by-side diff view of vague β measurable transformations
- Export β Download generated artifacts:
- π SRS Document (PDF)
- π User Stories (DOCX)
- π§ͺ BDD Scenarios (.feature)
- π Product Backlog (XLSX)
- π¦ Full Analysis Report (JSON)
# Run all tests
pytest tests/ -v
# Run with coverage report
pytest tests/ -v --cov=core --cov=modules --cov=outputs
# Run only unit tests
pytest tests/test_core.py tests/test_modules.py tests/test_outputs.py -v
# Run integration tests
pytest tests/integration/ -v
# Run regression / snapshot tests
pytest tests/regression/ -vAutoReq/
βββ app.py # π― Entry point β Streamlit orchestrator (1,495 lines)
βββ requirements.txt # π¦ Python dependencies (pinned)
βββ .env.example # π Environment variable template
β
βββ core/ # π§© Layer 1: NLP Preprocessing Engine
β βββ models.py # Pydantic v2 dataclasses (Requirement, ParsedDocument, AnalysisReport)
β βββ pipeline.py # β
Full orchestration β parallel analysis + 5-worker output generation
β βββ preprocessor.py # β
Stanza pipeline + KVKK masking (TC ID, personal names)
β βββ classifier.py # β
3-layer hybrid: verb suffix β NFR keywords β LLM fallback
β βββ ner.py # β
Multi-layer actor/object extraction (684 lines)
β βββ nlp_engine.py # NLP engine initialization
β βββ priority_detector.py # β
Rule-based priority with negation detection
β
βββ modules/ # π§ Layer 2: Intelligent Analysis (LLM)
β βββ llm_client.py # β
Triple-fallback: OpenRouter β Gemini β DeepSeek (333 lines)
β βββ llm_cache.py # β
Prompt caching with configurable TTL
β βββ conflict_detector.py # β
6-category pairwise conflict analysis
β βββ conflict_prompts.py # Prompt templates for conflict detection
β βββ gap_analyzer.py # β
Domain-aware gap detection with confidence scoring
β βββ gap_prompts.py # Prompt templates + DOMAIN_REFERENCES checklists
β βββ improver.py # β
Batch vagueβmeasurable transformation (parallel chunks)
β βββ improver_prompts.py # Prompt templates for improvement
β βββ story_prompts.py # Prompt templates for user story generation
β βββ bdd_prompts.py # Prompt templates for BDD scenario generation
β βββ analysis_report_parsing.py # LLM JSON β AnalysisReport normalizer
β βββ llm_response_utils.py # extract_json_object(), confidence sorting, ID validation
β βββ logging_utils.py # Loguru-based module logger utilities
β
βββ outputs/ # π Layer 3: Document Generators
β βββ srs_generator.py # β
Dynamic ISO 29148 SRS PDF (11 data-driven sections, 655 lines)
β βββ story_generator.py # β
LLM-powered User Story generator + DOCX export (362 lines)
β βββ bdd_generator.py # β
LLM-powered Gherkin BDD generator + .feature export (386 lines)
β βββ backlog_generator.py # β
Rule-based prioritized backlog with Fibonacci scoring (201 lines)
β βββ exporters.py # β
Multi-format export: XLSX, DOCX, JSON (290 lines)
β βββ logo_generator.py # Pillow-based logo PNG creator (CLI)
β βββ logo.png # Generated logo (used in SRS PDF header)
β βββ fonts/ # Bundled DejaVuSans fonts for Turkish character support
β βββ generated/ # Runtime output artifacts (gitignored)
β
βββ ui/ # π₯ Layer 4: Streamlit UI Components
β βββ i18n.py # β
Full Turkish/English internationalization (16.7KB)
β βββ components.py # β
Reusable widgets: req_card, conflict_card, badges, diff views
β βββ dashboard.py # Dashboard layout
β βββ results.py # Tabbed results panel
β βββ file_loader.py # File upload handling
β βββ state.py # Session state initialization
β βββ pages/ # 4-page navigation
β βββ 01_input.py # Text input + demo scenario selection
β βββ 02_analysis.py # Analysis progress + pipeline execution
β βββ 03_results.py # Tabbed results (requirements, conflicts, gaps, improvements)
β βββ 04_export.py # Download panel for all artifact formats
β
βββ tests/ # π§ͺ Comprehensive Test Suite (190 tests)
β βββ conftest.py # Fixtures, sys.path setup, LLM mock helpers
β βββ test_core.py # Preprocessor, classifier, NER, models, priority tests
β βββ test_classifier_60.py # Detailed FR/NFR classification tests
β βββ test_ner_60.py # Actor/object extraction tests
β βββ test_priority_60.py # Priority detection tests
β βββ test_modules.py # Module-level integration tests
β βββ test_conflict_detector_60.py# Conflict detector with LLM mocking
β βββ test_gap_analyzer_60.py # Gap analyzer with LLM mocking
β βββ test_improver_60.py # Improver with LLM mocking
β βββ test_llm_response_utils_60.py# JSON extraction, filtering utilities
β βββ test_outputs.py # SRS, story, BDD, backlog, exporter tests
β βββ test_run_eval.py # Evaluation runner tests
β βββ integration/ # End-to-end pipeline tests
β β βββ test_e2e.py # 6 E2E tests covering full pipeline
β βββ regression/ # Golden contract + prompt snapshot tests
β β βββ test_golden_contract.py # Contract tests against known outputs
β β βββ test_llm_mock_fixtures.py# LLM mock fixture validation
β β βββ test_prompt_snapshots.py# Syrupy prompt snapshot tests
β βββ golden/ # Golden test data files
β
βββ data/ # π Datasets & Demo Content
β βββ demo_scenarios/ # 6 domain-specific demo texts
β β βββ 01_e_ticaret_celisma.txt
β β βββ 02_bankacilik_eksik.txt
β β βββ 03_egitim_mughrak.txt
β β βββ 04_kurumsal_portal_multi_actor.txt
β β βββ 05_mobil_app_nfr_agirlikli.txt
β β βββ 06_saglik_heldout.txt
β βββ evaluation/ # Evaluation corpora
β β βββ dev_corpus.json # 244 sentences across 8 domains (48KB)
β β βββ heldout_corpus.json # 113 sentences β healthcare + automotive (21KB)
β β βββ conflict_pairs.json # 50 intentional conflict pairs + controls (21KB)
β βββ samples/ # Sample input texts
β βββ templates/ # JSON requirement templates
β
βββ docs/ # π Documentation
βββ AGENT_GUIDE.md # β Comprehensive project tutorial (41KB)
βββ CONTEXT.md # Source-of-truth architecture reference
βββ FEATURES.md # Feature list & implementation status
βββ SRS.md # Software Requirements Specification
βββ AGENTS.md # AI agent integration guide
βββ Makale/ # Academic article drafts
βββ AutoReq-Pres.pdf # Project presentation (1MB)
βββ *.png # UI screenshots (input, analysis, results, export)
π For AI assistants and new contributors: start with
docs/AGENT_GUIDE.mdβ it lets you fully understand the project without reading any source file.
Once analysis is complete, AutoReq generates the following artifacts (all produced in parallel):
| Output | Format | Source | Description |
|---|---|---|---|
| π SRS Document | Dynamic (AnalysisReport) | ISO/IEC/IEEE 29148 compliant, 11 data-driven sections | |
| π User Stories | DOCX | LLM (Gemini) | Agile stories with acceptance criteria |
| π§ͺ BDD Scenarios | .feature (Gherkin) | LLM (Gemini) | Happy path + negative scenarios per requirement |
| π Product Backlog | XLSX | Rule-based scoring | Fibonacci story points, conflict-weighted prioritization |
| π¦ Analysis Report | JSON | Full pipeline | Complete AnalysisReport with all data (Pydantic serialized) |
AutoReq has a comprehensive test suite with 190 tests (including 106 snapshot tests):
tests/
βββ Unit Tests β Core NLP modules (preprocessor, classifier, NER, priority)
βββ Module Tests β LLM-dependent modules with mocked clients
βββ Output Tests β All 4 generators + 3 exporters
βββ Integration Tests β 6 end-to-end pipeline tests
βββ Regression Tests β Golden contracts + prompt snapshot tests (syrupy)
βββ Evaluation Runner β Corpus-based metric evaluation
# Full test suite (~500 seconds)
pytest tests/ -v
# Quick smoke test
pytest tests/test_core.py -vPhase 1 β Core Analysis Engine β
Complete
βββ β
Text preprocessing pipeline (Stanza + KVKK masking)
βββ β
3-layer hybrid FR/NFR classifier (94.7% accuracy)
βββ β
Multi-layer actor & object extraction (86.5% F1)
βββ β
Rule-based priority detection with negation handling
Phase 2 β Intelligent LLM Modules β
Complete
βββ β
Conflict detector β 6-category pairwise analysis (96.1% F1)
βββ β
Gap analyzer β domain-aware with confidence scoring
βββ β
Requirement improver β batch vagueβmeasurable transformation
βββ β
Triple-fallback LLM client (OpenRouter β Gemini β DeepSeek)
Phase 3 β Output Generation β
Complete
βββ β
Dynamic ISO 29148 SRS PDF (11 sections, Turkish fonts)
βββ β
User Story generator + DOCX export
βββ β
BDD Gherkin scenario generator + .feature export
βββ β
Product Backlog generator + XLSX export
βββ β
Multi-format exporters (JSON, XLSX, DOCX)
Phase 4 β UI & Developer Experience β
Complete
βββ β
4-page Streamlit dashboard with light/dark mode
βββ β
Turkish/English i18n
βββ β
6 demo scenarios across different domains
βββ β
190-test suite (unit, integration, regression, snapshot)
βββ β
Evaluation corpora (dev, held-out, conflict)
Phase 5 β Future Enhancements π Planned
βββ π² Transformer-based NER (BERT/LLM) for unseen domains
βββ π² English & German language support
βββ π² Jira / Azure DevOps API integration
βββ π² User experience studies with professional business analysts
Contributions are welcome! Follow our Scrum-based development workflow:
- Fork the repository
- Create a feature branch from
developgit checkout -b feature/your-feature-name
- Commit your changes using conventional commits
git commit -m "feat: add new analysis module" - Push your branch
git push origin feature/your-feature-name
- Open a Pull Request against
develop
| Prefix | Usage |
|---|---|
feat: |
New feature |
fix: |
Bug fix |
docs: |
Documentation changes |
test: |
Adding or updating tests |
prompt: |
LLM prompt modifications |
- β Every public function/class must have a docstring
- β Type hints are required on all function signatures
- β
Use
field(default_factory=list)for mutable defaults in dataclasses - β
No
print()in production code β use Loguru for logging - β PRs require at least 1 reviewer approval
π₯ For team structure and role assignments, see TEAM.md.
This project is licensed under the GNU General Public License v3.0 β see the LICENSE file for details.
Built with β€οΈ by the AutoReq-DevTeam
Better software starts with better requirements.