paknevis is a careful copy editor for Persian text: it fixes half-spaces, Arabic ي and ك, digits and punctuation, and leaves code, links and markup alone.
پاکنویس یک ویراستار دقیق برای متن فارسی است: نیمفاصلهها، «ي» و «ك» عربی، رقمها و نشانهگذاری را درست میکند و به کد، پیوندها و برچسبها دست نمیزند.
فهرست مشکلات
هیچ مشکلی پیدا نشد. ✨
در پروژهٔ خودتان
همین موتور بهصورت کتابخانهٔ پایتون، خط فرمان، هوک pre-commit و GitHub Action در دسترس است.
pip install "paknevis @ git+https://github.com/mrzroot/paknevis"
paknevis check docs/ # report
paknevis fix --diff thesis.tex # preview fixes
From messy to clean in four stepsاز نامرتب تا پاکنویس در چهار گام
Paste or point it at filesمتن بدهید یا فایلها را نشان دهید
Plain text, Markdown, HTML or LaTeX, in the editor above, the CLI or Python.متن ساده، مارکداون، HTML یا LaTeX؛ در ویرایشگر بالا، خط فرمان یا پایتون.
It protects what is not proseهرچه نوشته نیست کنار میرود
Code, URLs, e-mails, tags, math and LaTeX commands are fenced off and never changed.کد، نشانیها، ایمیل، تگها، فرمول و دستورهای LaTeX جدا میشوند و هرگز عوض نمیشوند.
25 rules read the rest۲۵ قاعده بقیه را میخوانند
Half-spaces (میروم, کتابها), Arabic ي/ك, digits, punctuation, spacing, quotes and common misspellings.نیمفاصله (میروم، کتابها)، ي/ك عربی، رقمها، نشانهگذاری، فاصلهها، گیومه و غلطهای رایج.
You review, then keepبازبینی میکنید و نگه میدارید
See every change with a rule id and a reason, or use
--diff/--checkin CI before anything is written.هر تغییر را با شناسهٔ قاعده و دلیلش میبینید؛ یا در CI با--diffیا--checkپیش از نوشتن بررسی میکنید.
ویراستاری دقیق که هیچوقت کد شما را خراب نمیکند.A careful copy editor that never breaks your code.
نیمفاصله، حروف عربی، نشانهگذاری، رقمها و غلطهای رایج را درست میکند و به کد، لینک، مارکآپ و فرمول دست نمیزند.It fixes ZWNJ, Arabic characters, punctuation, digits and common misspellings, and leaves code, URLs, markup and math alone.
آگاه از قالبFormat-aware
متن ساده، Markdown، HTML و LaTeX (با XePersian)؛ بلوکهای کد، فرانتمتر، تگها، فرمولها و \lr{…} محافظت میشوند. پشتیبانی اختیاری از .docx.Plain text, Markdown, HTML and LaTeX (XePersian-aware). Code, front matter, tags, math and \lr{…} are protected. Optional .docx support.
محافظهکارConservative by design
قاعدهها فقط در بافت فارسی عمل میکنند: Python 3.12 یا «میز» و «میدان» دست نمیخورند.Rules act only in Persian context: Python 3.12, 10GB or nouns like «میز» and «میدان» stay untouched.
تکرارپذیرIdempotent
fix(fix(x)) == fix(x)؛ با تستهای property-based همراه با «ناحیههای محافظتشده هرگز تغییر نمیکنند».fix(fix(x)) == fix(x), verified with property-based tests, along with “protected regions never change”.
۲۵ قاعدهٔ مستند25 documented rules
هر قاعده کد (PN203)، نام، شدت، توضیح دوزبانه و مثال دارد و جداگانه قابل خاموش کردن است.Each has a code (PN203), a name, a severity, a bilingual explanation and examples, and can be turned off.
قابل پیکربندیConfigurable
در pyproject.toml: سبک رقم، «خانهی» یا «خانهٔ»، واژهنامهٔ اختصاصی و دستورهای paknevis-disable.In pyproject.toml: digit style, «خانهی» vs «خانهٔ», custom dictionaries and inline paknevis-disable comments.
همین موتور، در مرورگرThe real engine, in your browser
ویرایشگر بالا خودِ پکیج پایتون را با Pyodide اجرا میکند؛ پس با CLI همیشه یکسان است و متن شما جایی نمیرود.The editor above runs the actual Python package via Pyodide, so it always agrees with the CLI, and your text never leaves the page.
یک جمله، شش اصلاح.One sentence, six fixes.
\section{} در این پژوهش \cite{goodfellow2016}.\section{بیان مسئله} در این پژوهش، روشهای جدید را بررسی میکنیم \cite{goodfellow2016}.۲۵ قاعده در ۵ دسته.25 rules in 5 families.
با paknevis explain PN203 توضیح کامل و مثال هر قاعده را ببینید.Run paknevis explain PN203 for the full explanation and examples of any rule.
نویسههاCharactersPN1xx
101ي → ی102ك → ک103«ه» غیرفارسیnon-Persian heh104تای گرد «ة»teh marbuta «ة»105رقمهای عربیArabic digits106سبک رقمdigit style
نیمفاصلهZWNJPN2xx
201نیمفاصلهٔ زائدstray / duplicate202می روم → میروم203کتاب ها → کتابها204بزرگ ترین → بزرگترین205خانه ای → خانهای
نشانهگذاریPunctuationPN3xx
301, → ،302; → ؛303? → ؟304فاصلهٔ پیش از نشانهspace before305فاصلهٔ پس از نشانهspace after306کمانک و گیومهbrackets & quotes307"…" → «…»308... → …309؟؟؟ → ؟
فاصلههاWhitespacePN4xx
401فاصلههای پشتسرهمrepeated spaces402فاصلهٔ پایان سطرtrailing whitespace403کشیده «ـ»kashida «ـ»
املاSpellingPN5xx
501واژهنامهٔ YAML قابل گسترشextensible YAML dictionary502لطفا → لطفاً
در ترمینال، کد، کامیت و CI.In your terminal, code, commits and CI.
هنوز در PyPI نیست؛ از گیتهاب نصب کنید (پایتون ۳٫۱۰ تا ۳٫۱۳). کدهای خروج مناسب CI: ۰ تمیز، ۱ مشکل، ۲ خطا.Not on PyPI yet, so install from GitHub (Python 3.10–3.13). CI-friendly exit codes: 0 clean, 1 issues, 2 error.
pip install "paknevis @ git+https://github.com/mrzroot/paknevis@v0.1.0" paknevis check docs/ # report problems paknevis fix --diff thesis.tex # preview fixes paknevis fix --check . # CI: exit 1 if files would change paknevis fix . # rewrite in place cat notes.txt | paknevis fix - # stdin → stdout paknevis explain zwnj-plural
import paknevis
paknevis.fix("كتاب هاي من") # 'کتابهای من'
paknevis.fix(md_text, syntax="markdown") # code, links, HTML untouched
paknevis.fix(text, digits="latin", disable=["kashida"])
for d in paknevis.lint("علي مي رود"):
print(d.code, d.rule, d.line, d.column, d.message, d.replacement)# .pre-commit-config.yaml repos: - repo: https://github.com/mrzroot/paknevis rev: v0.1.0 hooks: - id: paknevis # fixes files # - id: paknevis-check # report only
- uses: actions/checkout@v4
- uses: mrzroot/paknevis@v0.1.0
with:
paths: docs/ README.md
# command: check # or "fix"
# args: --fail-on errorپرسشهای رایجFrequently asked
متن من به سروری فرستاده میشود؟Is my text uploaded anywhere?
نه. Pyodide و پکیج یک بار دانلود میشوند و همهچیز داخل مرورگر اجرا میشود. CLI و Action هم کاملاً محلیاند.No. Pyodide and the package are downloaded once and everything runs in your browser. The CLI and the Action are fully local too.
کد و فرمولهای من را خراب نمیکند؟Will it mangle my code or math?
نه. کد درونخطی و بلوکی، URLها، تگها و ویژگیهای HTML، فرانتمتر، $…$، دستورهای LaTeX و محیطهای verbatim و TikZ محافظت میشوند؛ با تست بررسی شده که هرگز تغییر نکنند.No. Inline and fenced code, URLs, HTML tags and attributes, front matter, $…$, LaTeX commands and verbatim/TikZ environments are protected, and tests check they never change.
چرا بعضی نیمفاصلهها را اصلاح نمیکند؟Why does it skip some ZWNJ fixes?
پاکنویس قاعدهمحور است، نه تحلیلگر کامل صرفی. برای جلوگیری از خطای مثبت، فقط فهرست گزیدهای از ستاکها را اصلاح میکند. اگر خطایی دیدید جمله را در Issue بفرستید.It's rule-based, not a full morphological analyser. To avoid false positives it only fixes a curated list of stems. Spotted a miss or a false positive? Open an issue with the sentence.
«خانهی» یا «خانهٔ»؟«خانهی» or «خانهٔ»?
هر دو. با گزینهٔ ezafe (یا منوی بالا) سبک دلخواهتان را انتخاب کنید؛ رقمها هم فارسی، لاتین یا دستنخورده میتوانند بمانند.Either. Pick your style with the ezafe option (or the menu above). Digits can be Persian, Latin or left as they are.
مجوز؟License?
MIT. قلم وزیرمتن با مجوز SIL OFL 1.1 در همین صفحه میزبانی میشود.MIT. The Vazirmatn font is self-hosted on this page under the SIL OFL 1.1.