An intelligent assistant that analyzes cahier de charge documents (DOC / PDF) and extracts structured information to make specification documents effortless to read for developers.
Developers often waste hours reading long, unstructured cahiers de charge (specification documents) just to find key information: objectives, deadlines, budgets, and technical constraints.
Intelligent Requirements Assistant automates this process. Upload a DOC or PDF file, and the assistant instantly extracts and displays a clean, structured summary of everything that matters.
| Feature | Description |
|---|---|
| š Multi-format parsing | Supports .docx and .pdf files |
| šÆ Targets extraction | Detects project goals and objectives |
| āļø Technical Requirements | Extracts technical constraints and specifications |
| š¤ Outputs identification | Lists expected deliverables and outputs |
| š Date detection | Finds deadlines and important dates |
| š° Budget extraction | Identifies budget mentions and amounts |
| š© Flagged sentences | Highlights risky, ambiguous, or critical sentences |
| š¾ Persistence | Analysis history stored in SQLite via SQLAlchemy |
| š„ļø Simple UI | Lightweight frontend (HTML / CSS / JavaScript) |
āāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāā
ā DOC / PDF ā āāāāā¶ā Text Extraction āāāāāā¶ā NLP Analysis ā
ā upload ā ā ⢠python-docx ā ā ⢠RegEx patterns ā
āāāāāāāāāāāāāā ā ⢠pdfplumber ā ā ⢠spaCy NER ā
āāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāāāāāā ā
ā SQLite (SQLAlchemy) āāāāāāāāāāāāāāāā
ā analysis history ā Structured JSON output
āāāāāāāāāāāāāāāāāāāāāāāā ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāā
ā Frontend dashboard ā
ā (HTML/CSS/JS) ā
āāāāāāāāāāāāāāāāāāāāāāā
- Upload ā the user uploads a cahier de charge (
.docxor.pdf). - Extract ā raw text is extracted with
python-docxorpdfplumber. - Analyze ā a hybrid NLP pipeline combines RegEx patterns (dates, amounts, deadlines) with spaCy (sentence segmentation, entity recognition, keyword matching).
- Structure ā results are returned as clean JSON: targets, technical requirements, outputs, dates, budget, flagged sentences.
- Store & Display ā results are saved in SQLite and rendered in the frontend dashboard.
- Backend: Python, FastAPI
- NLP: spaCy, RegEx
- Document parsing: python-docx, pdfplumber
- Database: SQLite with SQLAlchemy ORM
- Frontend: HTML, CSS, JavaScript (no framework)
Assistant-intelligent/
|
|__analysis/
|__analytique_nlp.py
|__nlp_regex.py
|__nlp_spacy.py
|
ā__ backend/
|__api.py
|__clarity_score.py
|__database.py
|__models.py
|__text_extraction.py
|
|__frontend/
|__index.html
|__results.html
|__style.css
|__style-res.css
|__script.js
|__result.js
|
|__.gitignore
|__requirements.text
- Python 3.10+
- pip
# 1. Clone the repository git clone https://github.com/Wahiba-Labrini/intelligent-requirements-assistant.git cd intelligent-requirements-assistant # 2. Create & activate the virtual environment python -m venv venv # Windows venv\Scripts\activate # macOS / Linux source venv/bin/activate # 3. Install dependencies pip install -r requirements.txt # 4. Download the spaCy language model python -m spacy download en_core_news_sm
1. Start the FastAPI backend:
bash uvicorn api:app --reload
The API will be available at: http://127.0.0.1:8000
Interactive docs (Swagger UI): http://127.0.0.1:8000/docs
2. Open the application:
Visit http://127.0.0.1:8000 ā the frontend is served directly by FastAPI (no Live Server needed).
| Upload page | score result |
|---|---|
![]() |
![]() |
| Analysis results | Flagged sentences |
|---|---|
![]() |
![]() |
- š Multi-language support (French, English, Arabic)
- š¤ LLM integration (OpenAI / Ollama) for deeper semantic analysis
- š Comparison of multiple cahiers de charge side-by-side
- š¤ Export analysis as PDF / Word reports
- š„ User authentication & role management
- āļø Cloud deployment (Docker + hosting)
- š Confidence scoring for extracted entities
- š Advanced search & filtering over analysis history
-
Live Server + FastAPI = silent CORS failures: opening the frontend through Live Server (port 5500) while the API runs on
127.0.0.1:8000caused PDF analysis requests to fail silently ā no console errors, no visible feedback. The definitive fix: serve the frontend directly from FastAPI (StaticFiles) so both share the same origin ā the CORS problem disappears entirely. -
Silent failures are the hardest bugs: because the browser showed nothing in the console, a whole day was spent debugging the wrong layer. Lesson: always check the Network tab, not just the Console.
-
Always return (and verify) IDs end-to-end: the analyzer endpoint expected a document
id, but the upload endpoint didn't return one ā the frontend silently passedundefined. Fix: make/uploadreturn{"id": doc.id}and verify it in the frontend before calling the analyzer. -
Hybrid NLP > pure deep learning for this use case: combining targeted RegEx patterns with spaCy's linguistic models gave fast, explainable, and accurate extraction without heavy infrastructure.
-
PDF text extraction spacing is tricky: characters sometimes come out glued together (
lesexigencestechniques).layout=Truepreserves page layout but does not guarantee inter-word spaces. The reliable fix is extracting words and joining them with spaces:
python
words = page.extract_words(x_tolerance=1.5)
text += " ".join(w["text"] for w in words)
-
Designing the database schema early (SQLAlchemy models) saved significant refactoring time when adding the analysis-history feature.
-
Fixed thresholds fail on real-world PDFs ā proportional ones don't: one line in a cahier de charge kept extracting with glued words (
runtimeandimprovetheoveralluserexperience) no matter what we tried ālayout=True,x_tolerance=5,x_tolerance=3, evenextract_words(). The gaps between words on that line were simply smaller than any fixed tolerance. The definitive fix was rebuilding each line from raw chars and inserting a space only when the gap exceeded 20% of the font size ā a ratio that adapts to any document. Lesson: avoid magic numbers; make thresholds proportional to the data (font size, image width, etc.). -
Writing precise RegEx patterns for dates and budget amounts taught us the importance of handling multiple formats (e.g.
12/05/2026,12 mai 2026,50 000 DH).
Contributions are welcome! Feel free to open an issue or submit a pull request.
- Fork the repository
- Create your feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
- Wahiba Labrini ā [https://github.com/Wahiba-Labrini]
Made with ā¤ļø to make developers' lives easier.



