How luxshan2000/dravida-kavacham works
Project type and purpose
• DravidaKavacham is an open-source Python library (packaged on PyPI) for detecting abusive content in Dravidian languages (Tamil and Malayalam) using a pre-trained PyTorch model.
File structure
• Top-level files:
• LICENSE, .gitignore, pyproject.toml → packaging & licensing
• Readme.md, docs/ → user documentation and architecture details
• .github/workflows → CI/CD (lint, test, release)
• Core package folder: dravida_kavacham/
• __init__.py → exposes public API (AbuseDetector)
• model.py → defines the neural network architecture and weight loader
• predictor.py → wraps model inference, exposes predict() method
• utils.py → text preprocessing, tokenization, caching, download utilities
• notebooks/ → exploratory data analysis, demonstration
README for additional insights
• Key features: plug-and-play, local model download on first use, customizable extension points
• Dependencies: Python ≥3.10, PyTorch ≥2.2.0
• Usage: instantiate AbuseDetector(), call .predict(text)
a. Main components
1. Client/Application Code (user’s script or notebook)
2. Library Interface (AbuseDetector class in __init__.py)
3. Predictor Module (predictor.py)
4. Model Module (model.py)
5. Utilities Module (utils.py)
6. PyTorch Inference Engine
7. External Storage (model weights repository on PyPI/Hugging Face/remote URL)
b. Relationships & data flows
• The client calls AbuseDetector.predict(text)
• AbuseDetector delegates to Predictor → loads or reuses a Model instance
• Predictor invokes Utils for preprocessing (tokenize, normalize)
• Preprocessed data passed to the Model module
• Model module loads weights via Utils (downloads on first run, caches locally)
• Model performs inference via PyTorch engine
• Predictor postprocesses output (e.g., map logits → labels “Abusive”/“Clean”)
• Result returned to client
c. Architectural patterns & design principles
• Modular separation: interface, preprocessing, model definition, inference
• Lazy initialization and caching pattern: download heavy assets once
• Single Responsibility: each module has clear, minimal responsibilities
d. Key technologies & libraries
• Python packaging: pyproject.toml, setuptools
• PyTorch for neural network inference
• Optional: Hugging Face Hub or raw HTTP for model download
• CI/CD workflows for linting, testing, releases
• Branch into two modules side by side: Predictor and Utils
• Sidebar: show CI/CD pipelines and docs folder as auxiliary infrastructure