Description
Simple library to check the spelling of arabic sentences. This library uses a vocabulary that consists of +500K words, and uses 1-edit_distance and 2-edit_distance to correct the misspelled words. It also uses 1-ngram language model to correct the words depending on the previous context.
Installation
pip install ar-corrector
Usage
Correct word spelling
from ar_corrector.corrector import Corrector
corr = Corrector()
corr.spell_correct('بختب') # return 5 corrections with top frequencies
# [('بكتب', 61), ('برتب', 22), ('بختم', 21), ('بختي', 9), ('بخت', 7)]
corr.spell_correct('بختب', 2) # return 2 corrections with top frequencies
# [('بكتب', 61), ('برتب', 22),]
corr.spell_correct('بختب', 1) # return 1 correction with top frequency
# [('بكتب', 61)]
corr.spell_correct('لتمشتلميتلكب', 4) # return the same word
# لتمشتلميتلكب
corr.spell_correct('من') # return true
# True
Correct word spelling using the context
from ar_corrector.corrector import Corrector
corr = Corrector()
sent = 'أكدت قواءص التمذد في تشاد أنها تواضضل طريقها للعاحمة'
print(corr.contextual_correct(sent))
#أكدت قوات التمرد في تشاد أنها تواصل طريقها للعاصمة
sent = 'اتتنتهى حدث آبل المنتظو بالإعلاخ عن مموعة من المنتجات'
print(corr.contextual_correct(sent))
#انتهى حدث آبل المنتظر الإعلان عن مجموعة من المنتجات
Metadata
Release files for ar-corrector 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ar_corrector-1.1.6.tar.gz | 51.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ar_corrector-1.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.0 MB
Release files / ar_corrector-1.1.6.tar.gz
| Download URL | ar_corrector-1.1.6.tar.gz |
|---|---|
| Size | 51.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2eb287322c1fc10ac8e172374686da42af3137e370a320d81fa08bac7cef5d91
|
|
BLAKE2b-256 checksum How to use checksums |
371ba1fab0a76ae79dc03668f8c82c290c2299b6cc7e487c50b10200d1352931
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.8
|
Release files / ar_corrector-1.1.6-py3-none-any.whl
| Download URL | ar_corrector-1.1.6-py3-none-any.whl |
|---|---|
| Size | 53.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3d4a4fe8ff8696c922a5807757506e56c0d720258c7716bfca607b90a8e77f7
|
|
BLAKE2b-256 checksum How to use checksums |
2d32ce0b2170db48ab9227d08802f93ce1cb105fdcc97c532333fadc38281bf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.8
|