Aruuz Nigar - Urdu Poetry Scansion Tool
What is Aruuz Nigar?
Aruuz Nigar is an Urdu poetry scansion tool that helps poets and readers understand Urdu arūz by inferring the taqti of individual lines and matching them against known bahrs. It consists of two parts: Aruuz, a reusable Python library that performs the scansion and meter analysis, and Nigar, a Flask based web frontend that provides a basic interface for end-users. Here is how it looks...

Why create Aruuz Nigar?
Aruuz Nigar was created for my understanding of Urdu arūz. While tools such as Rekhta's taqti and Aruuz.com are available, Rekhta is proprietary and the publicly available Aruuz.com codebase is more than a decade old, written in C#. Aruuz Nigar aims to provide a modern, open source, developer friendly alternative with a clear semantic core that can run on both desktops and servers.
How to use Aruuz Nigar?
Download for Windows end-users
Download the executable file from HERE. Save and double click on aruuznigar.exe. A browser with the Web interface will launch, if it doesn't, open http://127.0.0.1:5000 in your browser. No install, setup or python needed!
Note: The Windows executable runs a local Flask web server and opens the interface in your browser. All processing happens locally on your machine, and no external network access is required.
For everyone else
Installation: Clone the repository:
git clone https://github.com/tariquesani/aruuz-nigar.git
cd aruuz-nigar/
Setup Virtual Environment
Windows:
python -m venv venv
venv\Scripts\activate
pip install --upgrade pip
pip install -e .
pip install -r requirements.txt
Linux/Mac:
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -e .
pip install -r requirements.txt
Run the Flask web application (Nigar):
python app.py
http://127.0.0.1:5000
The web app provides: - RTL (right-to-left) text input for Urdu poetry - RTL display of scansion codes - Meter matching and identification
For developers, use as a Python library (Aruuz):
from aruuz.scansion import Scansion
from aruuz.models import Lines
scanner = Scansion()
line = Lines("نقش فریادی ہے کس کی شوخیِ تحریر کا")
scanner.add_line(line)
results = scanner.scan_lines()
Project Structure
aruuz/- Main package (Aruuz library)scansion/- Core scansion engine modulescore.py- Main scansion engineword_analysis.py- Word-level analysisword_scansion_assigner.py- Word scansion assignmentcode_assignment.py- Code assignment logiclength_scanners.py- Length scanning functionsmeter_matching.py- Meter matching algorithmsprosodic_rules.py- Prosodic rules and adjustmentsscoring.py- Scoring mechanismsexplanation_builder.py- Explanation generation
tree/- Pattern matching treescode_tree.py- Code tree implementationpattern_tree.py- Pattern tree matchingstate_machine.py- State machine for pattern matching
database/- Database functionalityword_lookup.py- Word lookup from databasearuuz_nigar.db- SQLite database
utils/- Utility functionstext.py- Text processing utilitiesaraab.py- Diacritical marks handlinglogging_config.py- Logging configuration
meters.py- Meter definitions (bahrs)models.py- Data models (Lines, Words, etc.)app.py- Flask web application (Nigar frontend)templates/- Flask HTML templatesindex.html- Main interfacestatic/- Static web assets (CSS, etc.)scripts/- CLI scripts and utilitiesscan_poetry.py- Poetry scanning scriptscan_word.py- Word scanning scripttests/- Test suitelegacy/- Legacy test filestest_canonical_sher_to_bahr_mapping.py- Canonical test mappingsdocs/- Documentation filessetup.py- Package setup configurationrequirements.txt- Python dependencies
Notes
Word-level scansion intentionally over-generates. Canonical selection happens at line/meter level.
Attribution
Based on the original Aruuz by Sayed Zeeshan Asghar (thank you!)
Original: GPL-2.0 licensed
Aruuz Nigar Python port: GPL-3.0 licensed
Ported by Dr. Tarique Sani, 2026
Status
In Development - Works well for regular meters (bahr) - Will work with some caveats for bahr-e-hindi and bahr-e-zamzama - Does not support Rubai well
Bug Reports and Feedback very welcome
Aruuz Nigar is under active development, and bugs or incorrect scansion results are expected. If you encounter issues, please report them using GitHub Issues.
Documentation
The core Python library (aruuz/) is extensively documented using module-level docstrings and inline explanations for all public classes and functions. These docstrings describe the intended behavior, inputs, outputs, and design rationale of the scansion engine, meter matching, tree traversal, scoring, and utility modules.
The existing source documentation is suitable for automatic API documentation generation using tools such as Sphinx or similar docstring-based systems. Generated API documentation is not published yet and will be added once the public interfaces stabilize further.
License
GPL V3.0, See LICENSE file in parent directory.