Negar
Negar is an editor(=virastar in Persian) for Persian text. The project is initially inspired by virastar. Thank you Aziz for your great job.
Demo View 
Installation
PyPi
python-negar is available on PyPi:
$ pip install python-negar
Git
You can get the latest stable changes from the GitHub server:
$ git clone https://github.com/shahinism/python-negar.git
$ cd python-negar
$ python setup.py install
Zip, Tarball
You can download the latest tarball.
*nix
Get the latest tarball & install:
$ wget -O python-negar-master.tar.gz https://github.com/shahinism/python-negar/archive/master.tar.gz
$ tar xvzf python-negar-master.tar.gz && cd python-negar-master
$ python setup.py install
Windows
Download the latest zip archive.
https://github.com/shahinism/python-negar/archive/master.zip
Decompress it, and run the following command in the root directory of python-negar
$ python setup.py install
Requirements
$ pip install regex
Usage
Calling by default options:
from negar.virastar import PersianEditor
test = r"""قابلیت های ویراستار ' نگار ':
* جایگزینی
+ خط تیره های پیاپی نظیر (--) و (---) با معادل های استاندارد شان
+ سه نقطه ی پیاپی (...) با کاراکتر استانداردش در زبان فارسی
+ علایمی نظیر کوتیشن فارسی با گیومه ؛ 'نگار'
+ اعداد عربی '١٢٣٤٥٦٧٨٩٠' و انگلیسی '1234567890' با معادل فارسی
+ کاراکتر های غیر فارسی نظیر ',;%يةك' با معادل های فارسی
* تنظیم فاصله
+ کلماتی که با 'ی' پسوند همراه هستند مانند 'همه ی ' -- و البته امکان جایگزینی آن با حمزه 'ء' ( در صورت انتخاب کاربر )
+ پرانتز ها یا دیگر علایم ؛ ( نگار )
+ علائم نقطهگذاری ؛ بدون فاصله از قبل و با یک فاصله از بعد به استثنای اعداد اعشاری مانند 12.4
+ در پیشوند کلمات با نیمفاصله نظیر ' می شود '، ' میشود '، ' بی شک '، ' بیشک ' , ' خانه اش '، ' وظیفه شناس ' ، ' کمک تان ' و یا ' نمیرود '
+ در پسوند کلمات با نیمفاصله نظیر کتابها، خوشترین -- و البته امکان عدم تنظیم (در صورت انتخاب کاربر)
* جلوگیری از
+ استفاده ی بیش از یک علامت ؟؟؟؟ یا !!!
+ کشیـــــــــدگـــــــــــــــــی در کــــــــــــلمــــات
+ فضا های خالی بیش از حد"""
print(PersianEditor(text))
result:
قابلیتهای ویراستار «نگار»:
* جایگزینی
+ خط تیرههای پیاپی نظیر (–) و (—) با معادلهای استانداردشان
+ سه نقطهی پیاپی (…) با کاراکتر استانداردش در زبان فارسی
+ علایمی نظیر کوتیشن فارسی با گیومه؛ «نگار»
+ اعداد عربی «۱۲۳۴۵۶۷۸۹۰» و انگلیسی «۱۲۳۴۵۶۷۸۹۰» با معادل فارسی
+ کاراکترهای غیر فارسی نظیر «، ؛ ٪یهک» با معادلهای فارسی
* تنظیم فاصله
+ کلماتی که با «ی» پسوند همراه هستند مانند «همهی» – و البته امکان جایگزینی آن با حمزه «ء» (در صورت انتخاب کاربر)
+ پرانتزها یا دیگر علایم؛ (نگار)
+ علائم نقطهگذاری؛ بدون فاصله از قبل و با یک فاصله از بعد به استثنای اعداد اعشاری مانند ۱۲.۴
+ در پیشوند کلمات با نیمفاصله نظیر «میشود»، «میشود»، «بیشک»، «بیشک»، «خانهاش»، «وظیفهشناس»، «کمکتان» و یا «نمیرود»
+ در پسوند کلمات با نیمفاصله نظیر کتابها، خوشترین – و البته امکان عدم تنظیم (در صورت انتخاب کاربر)
* جلوگیری از
+ استفادهی بیش از یک علامت؟ یا!
+ کشیدگی در کلمات
+ فضاهای خالی بیش از حد
Enabling extra features/args:
##
args = []
args.append('fix-english-quotes')
args.append('cleanup-spacing')
print(PersianEditor(text, *args))
Full list of args with description:
--fix-dashes Disable fix dashes feature
--fix-three-dots Disable fix three dots feature
--fix-english-quotes Disable fix english quotes feature
--fix-hamzeh Disable fix hamzeh feature
--hamzeh-with-yeh Use 'Hamzeh' instead of 'yeh' for fix hamzeh feature
--fix-spacing-bq Disable fix spacing braces and qoutes feature
--fix-arabic-num Disable fix arabic num feature
--fix-english-num Disable fix english num feature
--fix-non-persian-chars Disable fix misc non persian chars feature
--fix-p-spacing Disable fix prefix spacing feature
--fix-p-separate Disable fix prefix separating feature
--fix-s-spacing Disable fix suffix spacing feature
--fix-s-separate Disable fix suffix separating feature
--aggresive Disable aggresive feature
--cleanup-kashidas Disable cleanup kashidas feature
--cleanup-ex-marks Disable cleanup extra marks feature
--cleanup-spacing Disable cleanup spacing feature
--trim-lt-whitespaces Disable Trim leading trailing whitespaces
--exaggerating_zwnj Disable suffix separation as much as possible
GUI & CLI
There are two companions with this repository to support GUI and CLI, named negar-gui and negar-cli, respectively.
Both of them are available on PyPI.
Contributors
Metadata
Release files for python-negar 1.4.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_negar-1.4.15.tar.gz | 46.4 kB | Without provenance | Details for python_negar-1.4.15.tar.gz |
Release files / python_negar-1.4.15.tar.gz
| Download URL | python_negar-1.4.15.tar.gz |
|---|---|
| Size | 46.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cea9ea9ac373155986fd645862bc6428ea7cebd3baeb40c0ce4a073d2558cd07
|
|
BLAKE2b-256 checksum How to use checksums |
5c1bbc8fcf066f9763adc4394531d678f7a8035ed46f35d6aeada5b628fdbaab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Security for python-negar 1.4.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.