A simple Python tool to strip Persian short vowel diacritics (fatha, kasra, damma, shadda, sukun) from text files while keeping tanween marks untouched.
- Removes only short-vowel diacritics:
Fatha (ﹶU+064E), Damma (ﹹU+064F), Kasra (ﹺU+0650), Shadda (ﹽU+0651), Sukun (ﹿU+0652) - Keeps tanween (
ًٌٍ) and other marks (maddah, hamza above/below) unchanged - Recursively processes all files inside a directory
- Supports UTF-8 encoded text files
- Dry-run mode to preview changes without modifying files
No dependencies beyond Python 3.6+.
git clone https://github.com/BaseMax/persian-diacritics-cleaner.git
cd persian-diacritics-cleanerRun the script with the path to the folder containing your text files:
python persian-diacritics-cleaner.py /path/to/folderTo see what would be changed without actually writing to files, add the --dry-run flag:
python persian-diacritics-cleaner.py /path/to/folder --dry-run| Argument | Description |
|---|---|
folder |
Path to the directory to process (required) |
--dry-run |
Preview changes only; no files are overwritten |
Before:
السَّلَامُ عَلَيْكُم
After:
السلام عليكم
Note that tanween remains intact:
شُكْرًا → شكرًا
| Diacritic | Unicode | Removed? |
|---|---|---|
| Fatha | U+064E | ✅ |
| Damma | U+064F | ✅ |
| Kasra | U+0650 | ✅ |
| Shadda | U+0651 | ✅ |
| Sukun | U+0652 | ✅ |
| Tanween Fath | U+064B | ❌ |
| Tanween Damm | U+064C | ❌ |
| Tanween Kasr | U+064D | ❌ |
| Maddah | U+0653 | ❌ |
| Hamza above | U+0654 | ❌ |
| Hamza below | U+0655 | ❌ |
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Copyright (c) 2026 Seyyed Ali Mohammadiyeh