Repository navigation
Releases
v0.3.0
New: transitivity, the passive, and the مدغم shape
mazini/lexiconkeeps each listed verb's ل / م / ك mark from the tables, which used to be dropped:transitivity(root, wazn)→"intransitive" | "transitive" | "both" | nulllexiconPassive(root, wazn)→ the passive that follows from it:"pass"(transitive: ضُرِبْتُ),"ipass"(intransitive: جُلِسَ عَلَيْهِ only),"nopass"(patterns that never take one: فعُل, انفعل, افعلّ…), ornullif not listed.
conjugate'spassiveoption also takes"pass","ipass"or"nopass"; anything else throwsMaziniError("bad_option"). The engine's guess from the pattern is often wrong for form I (it gives جلس a full passive, *جُلِسْتُ); passlexiconPassive(...)instead.reducible(root, wazn)says whether Arabic has the assimilated (مدغم) shape thatreduced: trueproduces: تفعّل / تفاعل with ف in ت ث د ذ ز س ش ص ض ط ظ, انفعل with م, اتّخذ / اتّزر / اتّحد, اسطاع, افعنلل with ل1 و or ي.conjugatestill applies it to any root, as the Lua module does (*اِكَّتَّبَ).
conjugate's output with default options is unchanged: byte-identical to Module:ar-verb on the 7,884 golden inputs, and all 16,593 book forms still match. The lexicon entry point grows from 46 KB to 55 KB (#17).
Demo
- The passive comes from the lexicon, with the verb's transitivity shown; a فعل لازم gets no passive unless the reader asks for the impersonal one (#17, #19).
- Options are offered only when they change the verb, labelled with the verb's own forms («الصيغة المُدغَمة: اِسَّمَّعَ بدل تَسَمَّعَ») (#16).
- Compact mobile layout (#18).
The Python port is released alongside with the same API: mazini 0.3.0.
Install
npm install mazini@0.3.0npm: https://www.npmjs.com/package/mazini/v/0.3.0
Full Changelog: v0.2.2...v0.3.0
v0.2.2
Metadata-only release: no library changes since 0.2.1.
Changes
- The package description now says the engine is verified against 16,593 printed forms (495 paradigms), the count since the upstream checkpoint-7 sync in 0.2.0. It still said 15,549. A comment in the demo source is corrected to match (#5).
Install
npm install mazini@0.2.2npm: https://www.npmjs.com/package/mazini/v/0.2.2
Full Changelog: v0.2.1...v0.2.2
v0.2.1
Maintenance release: no library changes since 0.2.0.
0.2.0 was published to npm by a manual workflow run before its GitHub Release existed. 0.2.1 is published from this release by the publish workflow, so the tag, the release and the npm package (with provenance) all come from the same commit.
Changes
- README: the demo's lexicon checkbox now reads «الأفعال الواردة في المعجم الحاسوبي فقط», with «المعجم الحاسوبي» linking to its Wikidata entry (#3). The live demo already has this.
package-lock.jsonnow records thelicensefield (#4).
Install
npm install mazini@0.2.1npm: https://www.npmjs.com/package/mazini/v/0.2.1
Full Changelog: v0.2.0...v0.2.1
v0.2.0
New: mazini/lexicon, "is it a verb?"
The engine conjugates any root on any pattern, and most such combinations are not words. The new mazini/lexicon entry point says which ones are attested, using the four root × pattern tables of m-bakni/arabic-morphology (جداول إحصاء الأفعال العربية, CC BY 4.0): 24,188 verbs over 7,626 roots.
import { isAttested, attestedWazns } from "mazini/lexicon";- API:
lexiconRoots(),attestedWazns(root),isAttested(root, wazn),LEXICON_INFO. Roots and patterns are written as forconjugate. Bad input throwsMaziniErrorwith the same codes. - It is a separate package export (
dist/lexicon.js, 46 KB), so importingmazinialone bundles none of it, and it never restrictsconjugate. The data (one fixed-width record per root: radicals in Buckwalter plus a bitmask of attested patterns) is decoded on first use. - Regenerate with
tools/gen_lexicon.pyfrom a dataset checkout (#1).
Demo: attested verbs by default
- A checkbox «الأفعال الواردة في المعجم فقط», on by default. With it on, the pattern menu greys out the patterns the lexicon doesn't list for the typed root (and moves the selection to a listed one), and the root field suggests the 7,626 roots. An unlisted root or verb shows a notice with a button to lift the restriction.
- Listed patterns are ticked in the menu, and the facts line says وارد / غير وارد.
- The choice is remembered. A link shared from the unrestricted page carries
all=1.
Engine: synced to upstream checkpoint 7
Mirrors ar-verb.lua:
GEMINATE_ITBAA_ROOTS+= شرر, لبب;SOUND_ROOTS+= VIII:زوج.SOUND_FORM_I_UU_ROOTSbecomesSOUND_FORM_I_ROOTS, keyedroot:vowels(هيء:uu, أوب:ia).- New
FORM_VIII_UNASSIMILATED_W_ROOTS(وشي: اِيتَشَى / يَوْتَشِي).
Fixtures regenerated from upstream: the book suite (and the demo's self-test) now covers 495 paradigms / 16,593 forms (was 462 / 15,549), all matched. Golden parity: 7,884 inputs / 744,356 variants. Hamza: 55,340. loose: 51,997.
Install
npm install mazini@0.2.0npm: https://www.npmjs.com/package/mazini/v/0.2.0
Full Changelog: v0.1.0...v0.2.0
v0.1.0
First release of mazini, an Arabic verb conjugator for JavaScript / TypeScript.
Give it a root and a pattern (وزن) and it returns every form of the verb: past, indicative, subjunctive, jussive and imperative, active and passive, in all thirteen persons, plus the participles and the مصدر. That is 119 slots, fully vocalised, with the attested alternative spellings.
It is a pure-TypeScript port of Arabic Wiktionary's conjugation engine, وحدة:ar-verb (descended from Module:ar-verb). A Python port with the same API and tests: mazini.
Highlights
conjugate(root, wazn, { vowels, reduced, passive }): patterns by Arabic name ("فعَل يفعُل") or form code ("I"…"X"), roots writtenكتب,ك ت بorك_ت_ب.WAZNS,SLOTS,classifyTriliteralVerb,loose, andMaziniErrorwith stable.codes.- Pure JS, zero dependencies, no data files. ESM + CommonJS, typed, Node 18–24 and every browser, ~90 KB.
- Live demo: forzagreen.github.io/mazini-js. Conjugate any verb, and run the 15,549 book assertions in the browser.
Verification
- Against the book: all 15,549 printed forms of the 462 paradigms in أنطوان الدحداح, معجم تصريف الأفعال العربية (
ar-conjugationdataset) are among the generated forms. - Against the Lua module: byte-identical output on 7,851 inputs (741,188 forms, footnotes and metadata fields, the same 201 rejected inputs), on every
process_hamzacall (54,202) and on theloose()parity set (51,041 records).
Install
npm install mazini@0.1.0Licence: CC BY 4.0.
npm: https://www.npmjs.com/package/mazini/v/0.1.0
The npm package was published from 6f1549c, a little before this tag. The library code (
src/) is identical. The tag only adds the licence (LICENSEand thelicensefield inpackage.json), a README note, a publish-workflow tweak and an analytics tag on the demo.