Skip to main content

Ghalatawi غلطاوي

Ghalatawi: Arabic Autocorrect library مكتبة للتصحيح التلقائي للغة العربية

ghalatawi logo

ghalatawi logo

PyPI - Downloads

PyPI - Downloads

Developpers: Taha Zerrouki: http://tahadz.com taha dot zerrouki at gmail dot com

Feat ures

value

Aut hors

Authors.md <https://github.com/linuxscout/ghalatawi/main/AUTHORS.md>

Rel ease

0.1

Lic ense

` GPL <https://github.com/linuxscout/ghalatawi/main/LICENSE>`__

Tra cker

linuxscout/ghalata wi/Issues

So urce

Github

F eedb acks

Comments

Acco unts

@Twitter)

Description

ghalatawi: Arabic Autocorrect library

التصحيح الإملائي من أهم الأدوات المستعملة في النشر والكتابة الإلكترونية، وتستعمل في البحث والاستعلامات، كما يعد من أهم الأدوات المرافقة للبرامج المكتبية. وفي بعض الحالات نحتاج لما يسمى بالتصحيح التلقائي للكلمات، وهو اقتراح تصحيح لأخطاء شائعة في الكتابة، مثل قلب حرفين، أو عدم الضغط على زر ما لإعطاء كلمة خاطئة، وتشيع في الكتابة بالعربية بعض الأخطاء مثل عدم التفريق بين همزة الوصل وهمزة القطع، والخلط بين الضاد والظاء، وإغفال نقطتي الياء، وكتابة التاء المربوطة هاء.

يهدف هذا المشروع إلى وضع قائمة للكلمات الخاطئة الشائعة وتصحيحها التلقائي، وكذا وضع التعبيرات المنتظمة التي تعبّر عن بعض الحالات.

AutoCorrect (Text replacement, Replace as you type) is a software function commonly found in word processors such as OpenOffice.org/LibreOffice. Its principal purpose is to correct common spelling or typing errors, saving time for the user. It is also used to automatically format text or insert special characters by recognizing particular character usage, saving the user from having to use more tedious functions[cf. wikipedia]. The common errors in Arabic, are confusion between Alef forms ( Alef with Hamza, Alef without Hamza), missig the Yeh dots, and missing the Teh-Marbuta dots.

This Project aims to construct a word list and a list of regular expressions for Arabic auto-correction.

مزايا:

Applications تطبيقات

  • قائمة التصحيح التلقائي في البرامج المكتبة OpenOffice/LibreOffice

  • تدقيق الأخطاء الشائعة في المواقع ذات المحتوى الضخم، مثل ويكيبيديا.

  • مساعدة الكاتب في برامج المراسلات، والترجمة، وغيرها.

  • تدقيق المدوّنات اللغوية (corpus).

  • تصحيح استعلامات البحث.

  • تصحيح الكتابة في الأجهزة المحمولة كالهوتاف الذكية.

  • AutoCorrect for word processors like OpenOffice/LibreOffice

  • Huge content site Autocorrection, like Wikipedia.

  • Writres and translators assitantance .

  • Corpora Autocorrection.

Usage

install

pip install ghalatawi

[requirement]

pyarabic>=0.6.8

import

>>> from ghalatawi.autocorrector import AutoCorrector

Examples

Detailed examples and features in Features

  • Autocorrect a text

from ghalatawi.autocorrector import AutoCorrector
autoco = AutoCorrector()
text = 'اذا أردت إستعارة كتاب ، اذهب الى المكتبه او الادارة فى الضهيرة .'
autoco.spell(text)

output

'إذا أردت استعارة كتاب، اذهب إلى المكتبة أو الادارة في الظهيرة.'
  • Show methods used in spelling

from ghalatawi.autocorrector import AutoCorrector
autoco = AutoCorrector()
autoco.show_config()
{'regex': True, 'wordlist': True, 'punct': True, 'typo': True}
  • Allow/disallow methods used in spelling

from ghalatawi.autocorrector import AutoCorrector
autoco = AutoCorrector()
# remove regex method from spelling
autoco.unset_allow("regex")
text = 'اذا أردت إستعارة كتاب ، اذهب الى المكتبه او الادارة فى الضهيرة .'
# The word إستعارة will no be corrected
expected_text = 'إذا أردت إستعارة كتاب، اذهب إلى المكتبة أو الادارة في الظهيرة.'
result_text = autoco.spell(text)
bool(result_text == expected_text)
# Allow regex
autoco.set_allow("regex")
expected_text = 'إذا أردت استعارة كتاب، اذهب إلى المكتبة أو الادارة في الظهيرة.'
result_text = autoco.spell(text)
bool(result_text == expected_text)
True
True
  • Adjust punctuations in text

    >>> from ghalatawi.autocorrector import AutoCorrector
    >>> autoco = AutoCorrector()
    >>> text = "قال : للصائم فرحتان : فرحة حين يفطر ، وفرحة حين يلقى ربه  ."
    >>> autoco.adjust_pounct(text)
    'قال: للصائم فرحتان: فرحة حين يفطر، وفرحة حين يلقى ربه.'
  • Adjust typos in text

    >>> from ghalatawi.autocorrector import AutoCorrector
    >>> autoco = AutoCorrector()
    >>> text = "اشتريت الخبز و الحليب و الخضر و قليلا من الفاكهة."
    >>> autoco.adjust_typo(text)
        'اشتريت الخبز والحليب والخضر وقليلا من الفاكهة.'
  • Autocorrect a word by regex

    >>> from ghalatawi.autocorrector import AutoCorrector
    >>> autoco = AutoCorrector()
    >>> word=u"الإجتماعية"
    >>> autoco.autocorrect_by_regex(word)
    الاجتماعية
  • Autocorrect a word by autucorrection word list; with given word list

    >>> from ghalatawi.autocorrector import AutoCorrector
    >>> autoco = AutoCorrector()
    >>> autocorrectlist={
    ...                 u'اذا':u'إذا',
    ...                 u'او':u'أو',
    ...                 u'فى':u'في',
    ...                 u'هى':u'هي',
    ...                 u'انت':u'أنت',
    ...                 u'انتما':u'أنتما',
    ...                 u'الى':u'إلى',
    ...                 u'التى':u'التي',
    ...                 u'الذى':u'الذي',
    ...                 }
    >>> word=u"اذا"
    >>> autoco.autocorrect_by_wordlist(word, autocorrectlist)
    'إذا'
  • Autocorrect a word by autucorrection word list; with default word list

    >>> from ghalatawi.autocorrector import AutoCorrector
    >>> autoco = AutoCorrector()
    >>> word=u"اذا"
    >>> # default word list
    >>> autoco.autocorrect_by_wordlist(word)
    إذا
  • Load a specific wordlist Autocorrect a word by autucorrection word list

>>> from ghalatawi.autocorrector import AutoCorrector
>>> autoco = AutoCorrector()
>>> autocorrectlist = autoco.load_wordlist("data/arabic.acl")
>>> word=u"اذا"
>>> autoco.autocorrect_by_wordlist(word, autocorrectlist)
إذا

Metadata

Release files for ghalatawi 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for ghalatawi 0.3
File Interpreter ABI Platform Actions
ghalatawi-0.3-py3-none-any.whl Python 3 none any Details for ghalatawi-0.3-py3-none-any.whl

Release files / ghalatawi-0.3-py3-none-any.whl

Download URL ghalatawi-0.3-py3-none-any.whl
Size 7.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
19153f751e4fec2ce2330bcca9dc64f0061c07f7e1ef1800ada4e13a4d83302c
BLAKE2b-256 checksum
How to use checksums
6f8f015d12e92f3e7c72c0ec36e6ad0b3258a55aeaec2599976783e1848dd1e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Security for ghalatawi 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page