/ Модель

Характеристики

Лицензия
Своя лицензия
Библиотека
transformers
Опубликована
21 окт 2026

dialectnorm

Разметка токеновТекст → label3 профессии
8скачиваний за 30 дней0лайковвеса обновлены23 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

DialectNorm нормализует написание разговорного арабского текста по стандарту CODA для одного из 12 поддерживаемых диалектов.

DialectNorm — модель для нормализации орфографии разговорного арабского языка в соответствии со стандартом CODA. Она исправляет непоследовательное написание букв, смешение та-марбуты и ха, замены и удлинения букв, разделение и слияние слов, а также пробелы при пунктуации, сохраняя диалектную лексику и грамматику; перевод в современный литературный арабский не выполняет. Модель разработана как символьный теггер редактирования на основе 12-слойного арабского BERT-base с символьными признаками и двухслойной двунаправленной LSTM; размер — 143 млн параметров. Она принимает предложения вместе с названием диалекта и поддерживает египетский, ливанский, сирийский, палестинский, катарский, эмиратский, иракский, йеменский, суданский, ливийский, тунисский и марокканский диалекты. Текст обрабатывается фрагментами до 100 слов.

Модель обучена на парах исходного текста и написания CODA, включая предложения с ручной и автоматической разметкой. Порог уверенности помогает ограничить лишние правки; заявленная точность правок превышает 80% для каждого поддерживаемого диалекта. Для работы нужно правильно указать диалект. Модель предназначена только для орфографической нормализации: она не исправляет грамматику, выбор слов или стиль и не переводит текст. Формальный литературный арабский, смешанный текст с Arabizi или латиницей и очень длинные документы не входили в обучение. В метаданных указана лицензия other; конкретные условия использования следует сверить с карточкой модели.

Сценарии применения

  • нормализация орфографии египетского арабского
  • приведение написания арабских диалектов к стандарту CODA
  • исправление разделения и слияния слов в разговорном арабском
  • очистка арабских публикаций в социальных сетях от удлинений букв и ошибок пунктуации

Ограничения

Для нормализации необходимо указать верный диалект; качество на диалектах вне поддерживаемых 12 не оценивалось. Модель не исправляет грамматику, словоупотребление или стиль и не предназначена для формального литературного арабского, текста Arabizi и очень длинных документов.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

DialectNorm

DialectNorm normalizes the spelling of dialectal Arabic into CODA (Conventional Orthography for Dialectal Arabic). It fixes inconsistent spelling, ta marbuta / ha confusion, letter substitutions, word splits and merges, letter elongation and punctuation spacing, while keeping the dialect's own words and grammar. It does not translate into Modern Standard Arabic.

It supports 12 dialects: Egyptian, Lebanese, Syrian, Palestinian, Qatari, Emirati, Iraqi, Yemeni, Sudanese, Libyan, Tunisian and Moroccan.

Parameters143M
Typecharacter-level edit tagger (not generative)
Inputone or more sentences + the dialect name
Outputthe same text with CODA spelling
Licenseresearch-only, non-commercial (see LICENSE)

Architecture

DialectNorm is a sequence tagger. It predicts one edit label per input character instead of generating text, so it is fast and never rewrites words it was not asked to fix.

  1. Encoder: a 12-layer Arabic BERT-base encoder (hidden size 768) reads the input. Each character receives the state of the subword token that contains it.
  2. Character features: a learned 64-dimensional character embedding is concatenated to the encoder state.
  3. Sequence layer: a 2-layer bidirectional LSTM (384 units per direction), with a residual linear projection and LayerNorm.
  4. Edit head: a softmax over 250 edit labels. Each label means keep, delete or replace the character, optionally followed by an inserted string (for example a space or a letter).
  5. Decoding: an edit is applied only if its probability passes a confidence threshold (0.9, or 0.5 for punctuation edits). Otherwise the character is kept. This keeps precision high.
  6. Dialect conditioning: the dialect name is prepended to the input as a prefix word. The model uses it to apply that dialect's spelling conventions, and it is removed from the output.

Long inputs are processed in chunks of 100 words.

Why a learned model and not rules

A few CODA edits are mechanical (word-initial hamza on alef, letter elongation, punctuation spacing), but most depend on what the word is:

  • a final و is a pronoun in معو → معه but a plural ending in بيلعبو → بيلعبوا;
  • a final ه is a ta marbuta in الدوله → الدولة but the pronoun "his" in شغله, which stays;
  • ت → ث applies only to words that historically had ث (تالت → ثالث, but not تاكسي); Gulf ي → ج likewise (ويها → وجهها);
  • clitics split in قالي → قال لي but not in عالي;
  • each dialect has its own conventions.

Rules would need a full dictionary and a rule set per dialect, and good dialect dictionaries exist for only a few dialects. DialectNorm learns these decisions from 55,000 human-annotated sentences, using the context of each word, and a new dialect needs only a few thousand annotated sentences. A learned model can occasionally make an edit a rule never would; the confidence threshold keeps this rare (precision is above 80% for every dialect).

How to use

pip install torch transformers safetensors huggingface_hub
huggingface-cli login   # after your access request is approved
from huggingface_hub import snapshot_download
import sys

path = snapshot_download("ahmedsamirtarjama/dialectnorm")
sys.path.insert(0, path)
from dialectnorm import DialectNorm

normalizer = DialectNorm.from_pretrained(path)          # uses a GPU if available, otherwise the CPU

print(normalizer.normalize("الشجره الخبيثه اصلها خايس وفرعها في المجاري", dialect="Iraqi"))
# الشجرة الخبيثة اصلها خايس وفرعها في المجاري

print(normalizer.normalize(["اي اكتر شي بتستخدموا لتروحوا على المدرسة"], dialect="Palestinian"))
# ['اي اكثر شي بتستخدموا لتروحوا على المدرسة']

Arguments of normalize:

  • texts: a string or a list of strings.
  • dialect: one of Egyptian, Lebanese, Syrian, Palestinian, Qatari, Emirati, Iraqi, Yemeni, Sudanese, Libyan, Tunisian, Moroccan. The Arabic label also works.
  • threshold (default 0.9): minimum confidence for a letter edit. Lower values fix more but make more mistakes.
  • threshold_punct (default 0.5): the same, for punctuation edits.
  • batch_size (default 32).

Diacritics and tatweel are removed from the input before correction.

Examples

DialectInputDialectNorm outputMain fixes
Iraqiاذا هو شايل هلكد حمل المرور الي بلشارع شنو شغله حته ما وكفهاذا هو شايل هالقد حمل المرور الي بالشارع شنو شغله حتى ما وقفههلكد → هالقد · بلشارع → بالشارع · حته → حتى · وكفه → وقفه
Egyptianتمام . إمشي علطول و أحود يمين عند تالت ناصية . حتلاقيه عاليمين .تمام. امشي على طول واحود يمين عند ثالث ناصية. حتلاقيه عاليمين.علطول → على طول · و أحود → واحود · تالت → ثالث
Syrianياما شربان معو متة ؟ كنت صاحبو لهداك الشب ) وبتنقال لما الشب التاني بتعلا مراكزو (ياما شربان معه متة ؟ كنت صاحبه لهداك الشب ) وبتنقال لما الشب التاني بتعلا مراكزه (معو → معه · صاحبو → صاحبه · مراكزو → مراكزه
Palestinianعلى طول اسألها : - من بدو يجي عنا ?على طول اسألها : - من بده يجي عندنا ?بدو → بده · عنا → عندنا

Every output above is identical to the human-annotated reference. The "Main fixes" column lists the harder edits (words split or joined, letters added, removed or changed); hamza, ta marbuta and punctuation fixes are not listed. The Egyptian row comes from the MADAR CODA test set, the Syrian and Palestinian rows from the held-out test splits of their corpora, and the Iraqi row from the annotated Lisan corpus.

Training data

The model was trained on about 121,000 sentence pairs (raw text → CODA spelling) across the 12 dialects:

  • About 55,000 human-annotated pairs. Native-speaker linguists corrected the spelling to CODA.
  • About 66,000 automatically labelled pairs. These were added to widen vocabulary coverage for the five North African, Egyptian, Levantine and Gulf dialects with the most data. Their labels were produced automatically and filtered by agreement.

The text covers several styles:

  • short everyday and travel conversation sentences;
  • social-media posts and comments;
  • web-forum fiction and novels (Gulf);
  • informal discussions about local life, news and religion.

Spelling conventions follow CODA:

  • word-initial hamza on alef is not written (أنا → انا);
  • ta marbuta is restored (ه → ة);
  • dialect-specific letters are written etymologically (for example ث / ذ / ق where pronunciation differs);
  • clitics are attached or separated consistently;
  • repeated-letter elongation is removed;
  • punctuation is attached to the preceding word.

All text is undiacritized.

Each training sentence carries a country-level dialect label, which is passed to the model as a prefix.

Evaluation

The model was evaluated on held-out, human-annotated test sets that were never used for training or model selection. The metric is the M2 scorer F0.5 over word-level edits, the standard metric for Arabic error correction; it weights precision twice as much as recall. All settings, including the 0.9 threshold and the checkpoint, were chosen on validation data only, and each test set was decoded once.

DialectTest sentencesPrecisionRecallF0.5
Qatari30094.977.590.8
Lebanese30092.980.690.2
Tunisian30091.776.988.3
Egyptian30089.683.088.2
Moroccan30092.174.487.9
Syrian56791.572.987.0
Emirati1,44286.177.084.1
Yemeni2,65489.961.382.2
Palestinian60686.261.179.7
Iraqi29783.052.274.2
Sudanese20881.447.671.3
Libyan24981.244.669.7

MADAR CODA benchmark

MADAR CODA is the standard public benchmark for dialectal Arabic spelling normalization. It covers five city dialects: Beirut, Cairo, Doha, Rabat and Tunis. The scores below use its official test set (1,500 sentences) and the M2 F0.5 metric of the published work.

SystemTypeTest F0.5
GPT-4o (few-shot), reported by Alhafni & Habash (2025)LLM prompting55.9
Alhafni et al. (2024)single model86.3
Alhafni & Habash (2025), best single modelsingle model86.5
Alhafni & Habash (2025), 3-model ensembleensemble88.9
DialectNorm (143M)single model88.9

DialectNorm matches the best published ensemble with one 143M-parameter model, and it scores 2.4 points above the best published single model. Above, the five rows Qatari, Lebanese, Tunisian, Egyptian and Moroccan are this test set split by dialect.

Notes:

  • Lebanese also has a second, very small social-media test set (43 sentences), where F0.5 is 68.3.
  • Yemeni: some posts are reposted, and 126 test sentences also appear in the training data. Excluding them gives F0.5 81.97.
  • Precision is above 80% for every dialect. The weaker dialects (Iraqi, Sudanese, Libyan) lose mainly on recall: the model misses some corrections rather than making wrong ones. They had the least training data, about 2,000 sentences each.

Limitations

  • The dialect must be given. A wrong dialect label lowers quality, because spelling conventions differ by dialect. Dialects outside the 12 above have not been evaluated.
  • Spelling normalization only. It does not fix grammar, word choice or style, and it does not translate.
  • Domain. Formal Modern Standard Arabic, code-switched text (Arabizi, Latin script) and very long documents were not part of training.
  • Output follows CODA conventions, which may differ from other spelling standards (for example, word-initial hamza is dropped).

License

DialectNorm is released under a research-only, non-commercial license (see LICENSE). Access requires accepting these terms, and requests are approved automatically. For commercial use, contact the author.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · token-classification

Нельзя запустить

Доступ к модели ограничен автором; у платформы нет доступа к весам.

Ревизия весов
413545a

0 моделей