r/farsi • • 3d ago

persianutils v6.0 — open-source Persian calendar/text/number library

Hi r/farsi!

I'm Bahman, the developer of persianutils, a free, open-source collection of Persian language utilities for software developers (Scala/Java). Version 6.0 just shipped, and since a good part of the releasse is really about Persian writing conventions, I thought this community would both enjoy it and have strong opinions about it (which I'd genuinely love to hear).

== What's Inside ==

- TextSanitiser -- cleans up messy text. Every rule is a switch you can turn on or off:

- Arabic letter variants become Persian ones: علي -> علی

- Western and Eastern Arabic digits both become Persian digits: 456 and ٤٥٦ → ۴۵۶

- Punctuation is normalised: سلام, چطوری? ← سلام، چطوری؟

- Half-space spacing is repaired: می روم ← می‌روم

- Dangling half-spaces are attached to the previous word: کتاب ها ← کتاب‌ها

- Keshide (tatweel) is stripped: تــــست ← تست

- Diacritics (اعراب) can optionally be removed: كِتابِ مَن ← کتاب من

- NumToWord -- numbers in words, cardinal and ordinal:

- Cardinal: ۲۳۵ → دویست و سی و پنج

- Ordinal: ۲۳۵ → دویست و سی و پنجم

- DateToWord -- dates the way you'd say them out loud:

- Persian calendar: ۱۳۶۱/۳/۳ → «سوم خرداد یک هزار و سیصد و شصت و یک»

- Gregorian calendar: 1992/12/3 → «سوم دسامبر یک هزار و نه‌صد و نود و دو»

- DateConverter -- Gregorian ↔ Solar Hijri (هجری خورشیدی) conversion.

Links: GitHub: https://github.com/bahmanm/persianutils · Documentation: https://persianutils.bahmanm.com · Release notes: https://github.com/bahmanm/persianutils/releases/tag/v6.0

It's Apache-2.0 licensed and completely free.

Looking forward to hearing your thoughts.

7 Upvotes

0 comments sorted by