spaCy/spacy/lang/ar/tokenizer_exceptions.py
Daniël de Kok e2b70df012
Configure isort to use the Black profile, recursively isort the spacy module (#12721)
* Use isort with Black profile

* isort all the things

* Fix import cycles as a result of import sorting

* Add DOCBIN_ALL_ATTRS type definition

* Add isort to requirements

* Remove isort from build dependencies check

* Typo
2023-06-14 17:48:41 +02:00

48 lines
1.5 KiB
Python

from ...symbols import NORM, ORTH
from ...util import update_exc
from ..tokenizer_exceptions import BASE_EXCEPTIONS
_exc = {}
# Time
for exc_data in [
{NORM: "قبل الميلاد", ORTH: "ق.م"},
{NORM: "بعد الميلاد", ORTH: "ب. م"},
{NORM: "ميلادي", ORTH: ""},
{NORM: "هجري", ORTH: ".هـ"},
{NORM: "توفي", ORTH: ""},
]:
_exc[exc_data[ORTH]] = [exc_data]
# Scientific abv.
for exc_data in [
{NORM: "صلى الله عليه وسلم", ORTH: "صلعم"},
{NORM: "الشارح", ORTH: "الشـ"},
{NORM: "الظاهر", ORTH: "الظـ"},
{NORM: "أيضًا", ORTH: "أيضـ"},
{NORM: "إلى آخره", ORTH: "إلخ"},
{NORM: "انتهى", ORTH: "اهـ"},
{NORM: "حدّثنا", ORTH: "ثنا"},
{NORM: "حدثني", ORTH: "ثنى"},
{NORM: "أنبأنا", ORTH: "أنا"},
{NORM: "أخبرنا", ORTH: "نا"},
{NORM: "مصدر سابق", ORTH: "م. س"},
{NORM: "مصدر نفسه", ORTH: "م. ن"},
]:
_exc[exc_data[ORTH]] = [exc_data]
# Other abv.
for exc_data in [
{NORM: "دكتور", ORTH: "د."},
{NORM: "أستاذ دكتور", ORTH: "أ.د"},
{NORM: "أستاذ", ORTH: "أ."},
{NORM: "بروفيسور", ORTH: "ب."},
]:
_exc[exc_data[ORTH]] = [exc_data]
for exc_data in [{NORM: "تلفون", ORTH: "ت."}, {NORM: "صندوق بريد", ORTH: "ص.ب"}]:
_exc[exc_data[ORTH]] = [exc_data]
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)