Spaces:
Sleeping
Sleeping
metadata
title: NLP Intelligence
emoji: π€
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
NLP Intelligence β Social Monitoring Web Application
Hexagonal (Ports & Adapters) architecture for Mongolian social media content analysis.
Repository Structure
NLP-intelligence/
βββ nlp_core/ # Domain Core β NER, sentiment, topic modeling, preprocessing (pure Python)
βββ adapters/
β βββ api/ # FastAPI REST adapter (routers, schemas, services)
β βββ ner_mongolian/ # Fine-tuned NER model config/tokenizer (weights on HF Hub)
β βββ sumbee/ # Future Sumbee.mn integration
βββ frontend/ # Next.js dashboard & admin panel
βββ Data/ # Training data & reference datasets (NOT used at runtime)
β βββ data/ # CoNLL-format training/validation/test files (v1 pipeline)
β βββ datav2/ # JSONL character-offset training data + scripts (v2 pipeline)
β βββ NER-dataset/ # Reference data (locations.json, abbreviations, names)
βββ eval/ # Model evaluation scripts
βββ Dockerfile # Multi-stage production build
βββ nginx.conf # Reverse proxy config (port 7860)
βββ start.sh # Docker entrypoint
βββ requirements.txt
Production code: nlp_core/, adapters/api/, frontend/ β included in Docker image.
ML development: Data/, eval/ β excluded from Docker. See Data/README.md for details.
Model
The NER model is hosted on HuggingFace Hub: Nomio4640/ner-mongolian. It is downloaded automatically during Docker build and at runtime (if not cached locally). Model weights are NOT stored in git.
To version a new model after training:
git tag model-v1.0 -m "F1: 0.XX, trained on train_final.conll"
Quick Start
Local Development
# Backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cd adapters/api
PYTHONPATH=../../ uvicorn main:app --reload --host 0.0.0.0 --port 8000
API docs: http://localhost:8000/docs
# Frontend
cd frontend
npm install
npm run dev
Dashboard: http://localhost:3000
Docker
docker build -t nlp-intelligence .
docker run -p 7860:7860 nlp-intelligence
Usage
- Open http://localhost:3000
- Upload a CSV file with a
textorTextcolumn - View NER, sentiment, and network analysis results
- Go to
/adminto manage the knowledge base, labels, and stopwords
API Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /api/upload | Upload CSV for analysis |
| POST | /api/analyze | Analyze single text |
| POST | /api/analyze/batch | Analyze batch of texts |
| POST | /api/network | Get network graph data |
| POST | /api/insights | Get analysis insights |
| GET/POST | /api/admin/knowledge | Knowledge base CRUD |
| GET/POST | /api/admin/labels | Custom label mapping |
| GET/POST/DELETE | /api/admin/stopwords | Stopword management |