Skip to content

BaseMax/persian-diacritics-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Persian Diacritics Cleaner

A simple Python tool to strip Persian short vowel diacritics (fatha, kasra, damma, shadda, sukun) from text files while keeping tanween marks untouched.

Features

  • 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

Installation

No dependencies beyond Python 3.6+.

git clone https://github.com/BaseMax/persian-diacritics-cleaner.git
cd persian-diacritics-cleaner

Usage

Run the script with the path to the folder containing your text files:

python persian-diacritics-cleaner.py /path/to/folder

To 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

Options

Argument Description
folder Path to the directory to process (required)
--dry-run Preview changes only; no files are overwritten

Example

Before:

السَّلَامُ عَلَيْكُم

After:

السلام عليكم

Note that tanween remains intact:

شُكْرًا  →  شكرًا

What gets removed / kept

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

Copyright

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Copyright (c) 2026 Seyyed Ali Mohammadiyeh

About

A simple Python tool to strip Persian short vowel diacritics (fatha, kasra, damma, shadda, sukun) from text files while keeping tanween marks untouched.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages