# غزل (Ghazal) > Open tools for reading, writing and measuring Persian, and findings about the language, by Ali Julaee Rad. The site is in Persian. Each finding has a plain Markdown version (linked below) with its tables, citation and BibTeX. If you use a finding, its tools or its data, please cite it. ## API Ghazal checks and corrects Persian writing over HTTP, and reads it: vowel marks, metre and rhyme, word structure, verbs and their conjugation, Arabic passages, and the corpus normalizer. Tokenizer inspection and corpus search are website tools, with no v1 endpoint or MCP tool. Call the API from your server; it sends no CORS headers. Programs need a free key: sign in and make one at https://ghazalai.ir/account/, then send `Authorization: Bearer gz_...`; `compact: true` answers in fewer tokens. Text you send is kept to improve Ghazal; see [the privacy page](/privacy/). - [Everything for a first call, in one file](https://ghazalai.ir/llms-full.txt): the technical docs and the agent page. `check` and `fix` accept an optional `house` object: `ezafe: ye|hamza`, `digits: persian|latin|keep`, `quotes: guillemets|keep`. Omitted keys keep their defaults: ezafe follows `style`, digits are Persian and quotes use guillemets. Omit `house` to keep the existing behaviour. `ye` maps to `style: ghazal`, `hamza` to `style: academy`; conflicting values give 422. Latin digits replace Persian and Arabic-Indic digits in Persian prose, outside code, URLs, Latin text and anything Markdown skips. `keep` disables the corresponding rules and consistency suggestions. For Persian written by a language model, send `profile: llm` to `check`, `fix` or their MCP tools. It keeps a fixed set of reviewed rules and sets their levels; style findings stay style and detection stays unchanged. House preferences come first, then the profile, then `only`, `disable` and `min_severity`. These options cannot add rules outside the profile. Use `kind: formal` for friendly written prose. Omit `profile` for the existing answers. The skill accepts `fix.py --profile llm --kind formal FILE`. - [OpenAPI 3.1](https://ghazalai.ir/api/v1/openapi.json): every endpoint with one real request and answer. `check` and `fix` accept `words`: at most 500 personal words, each one word of at most 60 characters, without spaces. Matching uses the spell checker's folding of Arabic letters, half-spaces and marks. Only `spell.*` and `confuse.*` findings are hidden; spacing, punctuation and grammar remain. An absent or empty list leaves answers unchanged. The skill's `fix.py --words FILE` reads one word per line from a UTF-8 file. A personal plan, corporate plan or pack accepts a complete document of up to 200,000 characters. Free keys and callers without a key stay at 20,000. `texts` stays at 20,000 in all, including separating newlines. For a long document, `checked_to` is the end of the checked range in Unicode code points, even with `offsets: utf16`. Send the same complete text and options with `from: checked_to` until it reaches the end. Only the checked range is charged. A `from` outside the server's cuts gives 422. Short texts have no `checked_to`. Each piece is checked with up to 2,048 characters on either side. Only findings starting in the piece are returned. Distant repetitions, grammar evidence and model limits can make the result differ from checking the whole text in one piece. Spelling counts use the original document; rule conflicts are resolved within each piece. Here `fix` sends a POST to `/api/v1/fix`: ```python at, corrected = 0, [] while at < len(text): r = fix(text=text, offsets="codepoint", **{"from": at}) corrected.append(r["text"]); at = r.get("checked_to", len(text)) text = "".join(corrected) ``` Append each returned `text` without adding separators. `applied` points into the original complete text; `left` points into this answer’s corrected `text`, in the chosen `offsets` unit. To place `left` in the joined text, add the length already joined, in the same unit. A finding crossing a cut keeps its full `end`, which may exceed `checked_to` for `applied` or the returned text’s length for `left`. ## Docs - [نوشت‌یار](https://ghazalai.ir/docs/write.md): متن را در نوشت‌یار بنویسید یا بچسبانید؛ زیر هر جایی که پیشنهادی دارد خط می‌افتد و می‌توانید بپذیرید، رد کنید یا دلیلش را بخوانید. - [حساب، کلید، طرح‌ها و پرداخت](https://ghazalai.ir/docs/account.md): ورود با شماره‌ی موبایل، ساختن کلید برای برنامه‌ها، طرح‌ها و بسته‌ها، پرداخت و پاک کردن حساب. - [پرسش‌های رایج](https://ghazalai.ir/docs/faq.md): پاسخ کوتاه به پرسش‌هایی که درباره‌ی نوشت‌یار، کلید و API پیش می‌آید. - [شروع](https://ghazalai.ir/docs/start.md): نخستین درخواست به API غزل با کلید رایگان، با curl، Python و JavaScript. - [کلید و سقف‌ها](https://ghazalai.ir/docs/keys.md): چطور کلید رایگان بسازید، چقدر می‌شود فرستاد و left_today چه می‌گوید. - [بررسی متن: check](https://ghazalai.ir/docs/check.md): POST /api/v1/check متن را تغییر نمی‌دهد؛ فهرست پیشنهادها را با جای هر کدام، قاعده و جایگزین‌هایش برمی‌گرداند. - [درست کردن متن: fix](https://ghazalai.ir/docs/fix.md): POST /api/v1/fix متن درست‌شده را برمی‌گرداند، با آنچه تغییر کرد و آنچه برای تصمیم شما ماند. - [feedback، usage و rules](https://ghazalai.ir/docs/feedback.md): گزارش پذیرفتن یا رد یک پیشنهاد، مصرف یک کلید، و توضیح همه‌ی قاعده‌ها. - [یکدست کردن متن: normalize](https://ghazalai.ir/docs/normalize.md): POST /api/v1/normalize متن را به شکل متن یکدست پیکره‌ی غزل درمی‌آورد: فقط آنچه انتخاب نیست درست می‌شود و فهرست پیشنهادی در کار نیست. - [اعراب‌گذاری: vowels](https://ghazalai.ir/docs/vowels.md): POST /api/v1/vowels روی متن فارسی اعراب می‌گذارد، فقط جایی که مطمئن است، و برای هر واژه خوانش‌های ممکن را با وزنشان می‌دهد. - [وزن و قافیه: verse](https://ghazalai.ir/docs/verse.md): POST /api/v1/verse وزن، قافیه و ردیف شعر فارسی را می‌خواند، همان‌طور که شعرکاوی می‌خواند، و می‌گوید هر مصراع کجا از وزن بیرون می‌رود. - [ساختمان واژه: word](https://ghazalai.ir/docs/word.md): POST /api/v1/word می‌گوید یک واژه از چه ساخته شده: بن و پسوندها، تحلیل فعل، «ه» پایانی، و صورت نوشتاری اگر واژه گفتاری است. - [فعل و صرف آن: verb](https://ghazalai.ir/docs/verb.md): POST /api/v1/verb فعل‌های یک متن کوتاه را تحلیل می‌کند، زمان‌هایی را که با دو واژه ساخته می‌شوند می‌شناسد و جدول صرف هر فعل را می‌دهد. - [عبارت‌های عربی: arabic](https://ghazalai.ir/docs/arabic.md): POST /api/v1/arabic عبارت‌های عربی درون متن فارسی را پیدا می‌کند: آیه، حدیث، مصراع عربی و عبارت‌هایی مثل «علیه السلام». - [متن Markdown](https://ghazalai.ir/docs/markdown.md): با format: markdown فقط نثر بررسی می‌شود و کد، نشانی‌ها و نشانه‌های Markdown دست نمی‌خورند. - [جای پیشنهادها: offsets](https://ghazalai.ir/docs/offsets.md): start و end با UTF-16 یا با code point شمرده می‌شوند؛ هر کدام را که زبان برنامه‌تان به کار می‌برد انتخاب کنید. - [نوع متن و سبک](https://ghazalai.ir/docs/kinds.md): kind می‌گوید متن رسمی است یا محاوره، و style می‌گوید با سبک غزل بررسی شود یا با قاعده‌های فرهنگستان. - [خطاها](https://ghazalai.ir/docs/errors.md): هر خطای API یک بدنه‌ی یکسان دارد؛ اینجا هر کد، وضعیت HTTP آن و کاری که باید کرد. - [فهرست قاعده‌ها](https://ghazalai.ir/docs/rules.md): قاعده‌هایی که API امروز اجرا می‌کند، با نام، سطح، توضیح، نمونه و منبع هر کدام. - [نسخه و تغییرات](https://ghazalai.ir/docs/versions.md): آنچه نسخه‌ی ۱ API قول می‌دهد، و هر چه از ۲۲ آبان ۱۴۰۵ در آن تغییر کرده است. - [برای مدل‌های زبانی](https://ghazalai.ir/docs/agents.md): غزل را به عامل هوش مصنوعی‌تان بدهید تا فارسی درست‌تری بنویسد: روال کار، آنچه نباید درست شود، متنی برای پرامپت سیستمی و تعریف ابزار. - [سرور MCP](https://ghazalai.ir/docs/mcp.md): غزل را با MCP به عامل هوش مصنوعی‌تان وصل کنید: نشانی، کلید رایگان، شش ابزار، فایل تنظیمات و سقف‌ها. ## For agents - [Give Ghazal to your agent](https://ghazalai.ir/docs/agents-en.md): the loop, what not to fix, a paragraph for a system prompt and the tool definition (English). - [A skill folder](https://ghazalai.ir/skill/ghazal-persian/SKILL.md): read SKILL.md once, then run python3 /fix.py FILE to correct the delivery file in place; [the guide for a system prompt](https://ghazalai.ir/skill/ghazal-persian/guide.md) and [fix.py](https://ghazalai.ir/skill/ghazal-persian/fix.py). ## Findings - [تشخیص کسره‌ی اضافه پس از «ه» در فارسی رسمی و محاوره‌ای (Detecting the ezāfe after ه in formal and informal Persian)](https://ghazalai.ir/findings/ezafe-heh.md): ابزار نوشتار فارسی درباره‌ی کسره‌ی اضافه پس از «ه» دو تصمیم دارد. در متن ویراسته، اضافه پس از «ه» ناملفوظ اغلب نوشته نمی‌شود (خانه پدرم) و ابزار باید بداند اضافه هست یا نه. در متن محاوره‌ای، گاهی خود اضافه را «ه» می‌نویسند (دیواره اتاق به جای دیوارِ اتاق)؛ خطایی کم‌یاب میان انبوه «ه»‌های درست. در دو دور نخست هیچ مدلی به‌روشنی از بقیه بهتر نبود. در دور سوم، با برچسب‌های برچسب‌زن Hazm، شمارش‌هایی از پیکره و مدل زبانی TookaBERT، هم‌خوانی تشخیص اضافه‌ی نانوشته با ۵۲۴ برچسب من از ۰٫۸۰۵ به ۰٫۹۱۶ در پایتون خالص و ۰٫۹۲۶ با TookaBERT رسید. برای «ه» به جای اضافه، ترکیب TookaBERT با شمارش‌های املایی در آزمون نهایی، روی متنی که هیچ جا به کار نرفته بود، به precision ۰٫۹۷ رسید و دو برابر ابزار پیشین خطای واقعی پیدا کرد. ## Website tools - [نوشت‌یار, writing assistant](https://ghazalai.ir/write/): spacing, half-spaces, punctuation and spelling of Persian text, with the reason for each suggestion. - [شعرکاوی, verse explorer](https://ghazalai.ir/verse/): syllables, metre, rhyme and radif of Persian poems, with other readings and where the metre breaks. - [واژه‌کاوی, word lens](https://ghazalai.ir/word/): reading, structure, inflection and use of Persian words. - [توکن‌کاوی, tokenizer microscope](https://ghazalai.ir/tokens/): where five common tokenizers split Persian text and what they lose. - [مسئله‌ساز, problem maker](https://ghazalai.ir/reason/): logic, arithmetic and chess problems one program builds and a separate program solves again. - [Corpus](https://ghazalai.ir/corpus/): the Ghazal Corpus, searchable in context with collocates; [word list](https://ghazalai.ir/corpus/words/), [methods and licences](https://ghazalai.ir/corpus/about/). - [ghazal-nlp](https://github.com/ghazalai/ghazal-nlp): the Python package behind the tools (MIT).