hebrew-acronyms · מילון ראשי תיבות בעברית

A dictionary of 414 common Hebrew acronyms with functions that look them up, find them in a text and expand them to full words.
צה״ל → צבא הגנה לישראל · מע״מ → מס ערך מוסף · וכו׳ → וכולי
Hebrew text is full of acronyms written with a gershayim mark. A text-to-speech engine reads מנכ״ל letter by letter, a search index does not connect מע״מ with מס ערך מוסף, and a language model that meets a rare one guesses. This package gives you the words behind the letters.
- Text to speech and voice agents.
expand() replaces the acronyms with their spoken form before the text goes to the engine.
- Search. Someone who types מס ערך מוסף also finds documents that say מע״מ.
- Chatbots and NLP. Find the acronyms in a text, see what each one means and which field it belongs to.
The functions accept the Hebrew gershayim (״) and a plain quote ("), ignore nikud, and recognise prefix letters attached to an acronym (ובצה״ל, למנכ״ל, שהרמטכ״ל).
Install
pip install hebrew-acronyms
No dependencies. Python 3.10 or newer. Type hints included.
Use
from hebrew_acronyms import expand, find_acronyms, lookup, search
expand("המנכ״ל אישר את הדו״ח של רו״ח")
# 'מנהל כללי אישר את דין וחשבון של רואה חשבון'
lookup('ובצה"ל')
# LookupResult(acronym='צה״ל', normalized='צהל',
# meanings=(Meaning(text='צבא הגנה לישראל', category='army'),), prefix='וב')
[entry.acronym for entry in search("מס ערך")]
# ['מע״מ']
[(hit.match, hit.index) for hit in find_acronyms("חברה בע״מ, כולל מע״מ")]
# [('בע״מ', 5), ('מע״מ', 16)]
Acronyms with several meanings
ב״ב can be בני ברק and also בבא בתרא. By default expand() leaves such an acronym as it is, so that it never puts the wrong words into a sentence. To take the first meaning:
expand("נסענו לב״ב", ambiguous="first")
API
| Function |
What it does |
lookup(word) |
The entry for one acronym, with the prefix letters it carried, or None |
search(query, *, category=None, limit=20) |
Entries whose letters start with the query or whose meaning contains it |
expand(text, *, ambiguous="keep") |
The text with every known acronym replaced by its spoken form |
find_acronyms(text) |
Every known acronym in the text with its position |
normalize(value) |
The letters without quote marks, nikud, dots, hyphens and spaces |
category_label(category) |
The Hebrew name of a field |
ACRONYMS, CATEGORIES |
The dictionary itself and the nine fields |
Fields: army, torah, law, state, business, general, edu, health, units.
[entry.acronym for entry in search("ר", category="army", limit=3)]
Limits
- The list covers common acronyms, not all of them. Hebrew has thousands, and new ones appear all the time.
expand() only touches a word that carries a gershayim or geresh mark, so an ordinary word that happens to match the letters of an acronym stays as it is.
- Choosing between several meanings needs the context. The package does not guess.
The same dictionary elsewhere
בעברית
מילון של 414 ראשי תיבות נפוצים בעברית לפייתון, עם פונקציות לחיפוש, לזיהוי בטקסט ולפריסה למילים מלאות.
- סוכנים קוליים ו-TTS. מנועי הקראה מקריאים את ״מנכ״ל״ כאותיות.
expand() פורס את ראשי התיבות לפני שהטקסט נשלח להקראה.
- חיפוש. מי שמחפש ״מס ערך מוסף״ ימצא גם מסמכים שכתוב בהם מע״מ.
- צ׳אטבוטים ו-NLP. מזהים ראשי תיבות בטקסט, יודעים מה הם אומרים ולאיזה תחום הם שייכים.
הפונקציות עובדות עם גרשיים עבריים (״) ועם מירכאות רגילות ("), מתעלמות מניקוד ומזהות אותיות שימוש בתחילת המילה (ובצה״ל, למנכ״ל, שהרמטכ״ל). ראשי תיבות עם כמה פירושים, כמו ב״ב, נשארים כמו שהם, אלא אם מבקשים ambiguous="first".
המילון נבנה ב-Aiterra בשביל כלי ראשי התיבות החינמי באתר.
Licence
MIT. Built by Aiterra, a software studio in Israel that builds AI agents, voice agents and websites.