Skip to main content

Alyahmor Arabic Morphological Genrator for Python

Project description

Alyahmor اليحمور

Arabic flexionnal morphology generator

Description

The Alyahmor produce a word form from (prefix, lemma, suffix). It has many functionalities: - Generate word forms from given word and affixes - Generate all word forms by adding verbal or nominal affixes according to word type - Generate all affixes combination for verbs or nouns which can be used in morphology analysis.

Developpers:

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

Features | value ———|——————————————————————————— Authors | Authors.md Release | 0.1 License |GPL Tracker |linuxscout/alyahmor/Issues Accounts |[@Twitter](https://twitter.com/linuxscout)

Citation

If you would cite it in academic work, can you use this citation

T. Zerrouki‏, Alyahmor, Arabic mophological  generator Library for python.,  https://pypi.python.org/pypi/alyahmor/, 2019

or in bibtex format

@misc{zerrouki2019alyahmor,
  title={alyahmor, Arabic mophological generator Library for python.},
  author={Zerrouki, Taha},
  url={https://pypi.python.org/pypi/alyahmor},
  year={2019}
}

Applications

  • Text Stemming

  • Morphology analysis

  • Text Classification and categorization

  • Spellchecking

Features مزايا

  • Arabic word Light Stemming.

  • Features:

    • Generate word forms from given word and affixes

    • Generate all word forms by adding verbal or nominal affixes according to word type

    • Generate all affixes combination for verbs or nouns which can be used in morphology analysis.

Installation

pip install alyahmor

Requirements

pip install -r requirements.txt

أصل التسمية

اليَحْمُور، وهو الحسن بن المعالي الباقلاني أبو علي النحوي الحلي شيخ العربية في زمانه في بغداد من تلامذة أبي البقاء العكبري ت ٦٣٧هـ

وكتب بخطه كثيراً من الأدب واللغة وسائر الفنون، وكان له همةٌ عالية، وحرصٌ شديد؛ وتحصيل الفوائد مع علو سنه، وضعف بصره، وكثرة محفوظه، وصدقه، وثقته، وتواضعه، وكرم أخلاقه.

وانتقل آخر عمره إلى مذهب الشافعي، وانتهت إليه رياسة النحو. مولده سنة ثمان وستين وخمسمائة، وتوفي سنة سبع وثلاثين وستمائة. المزيد عن اليحمور

Usage

Example

Generate words forms

It joins word with affixes with suitable correction for example

بال+كتاب +ين => بالكتابين ب+أبناء+ه => بأبنائه

Nouns

To generate all forms of the word كتاب as noun use

>>> import alyahmor.genelex
>>> generator = alyahmor.genelex.genelex()
>>> word = u"كِتِاب"
>>> noun_forms = generator.generate_forms( word, word_type="noun")
>>>noun_forms
[u'آلْكِتَاب', u'آلْكِتَابا', u'آلْكِتَابات', u'آلْكِتَابان', u'آلْكِتَابة', u'آلْكِتَابتان', u'آلْكِتَابتين', u'آلْكِتَابون', u'آلْكِتَابي', u'آلْكِتَابيات'
....]
Verbs

To generate all forms of the word كتاب as verb, use

>>> import alyahmor.genelex
>>> generator = alyahmor.genelex.genelex()
>>> word = u"استعمل"
>>> verb_forms = generator.generate_forms( word, word_type="verb")
>>>verb_forms
[u'أَأَسْتَعْمِلَ', u'أَأَسْتَعْمِلَكَ', u'أَأَسْتَعْمِلَكُمَا', u'أَأَسْتَعْمِلَكُمْ', u'أَأَسْتَعْمِلَكُنَّ', u'أَأَسْتَعْمِلَنَا', u'أَأَسْتَعْمِلَنِي', u'أَأَسْتَعْمِلَنَّ', u'أَأَسْتَعْمِلَنَّكَ', u'أَأَسْتَعْمِلَنَّكُمَا',

....]
Generate non vocalized forms

To generate all forms of the word كتاب as noun without vocalization use

>>> import alyahmor.genelex
>>> generator = alyahmor.genelex.genelex()
>>> word = u"كِتِاب"
>>> noun_forms = generator.generate_forms( word, word_type="noun", vocalized=False)
>>>noun_forms
[u'آلكتاب', u'آلكتابا', u'آلكتابات', u'آلكتابان', u'آلكتابة', u'آلكتابتان', u'آلكتابتين', u'آلكتابون', u'آلكتابي', u'آلكتابيات',
....]
Generate a dictionary of vocalized forms indexed by unvocalized form

To generate all forms of the word كتاب as noun as a dict of grouped all vocalized forms by unvocalized form use

>>> import alyahmor.genelex
>>> generator = alyahmor.genelex.genelex()
>>> word = u"كِتِاب"
>>> noun_forms = generator.generate_forms( word, word_type="noun", indexed=True)
>>>noun_forms
{u'أككتابة': [u'أكَكِتَِابَةِ', u'أكَكِتَِابَةٍ'],
 u'أوككتابة': [u'أَوَكَكِتَِابَةِ', u'أَوَكَكِتَِابَةٍ'],
 u'وكتابياتهم': [u'وَكِتَِابياتهِمْ', u'وَكِتَِابِيَاتُهُمْ', u'وَكِتَِابِيَاتِهِمْ', u'وَكِتَِابِيَاتُهِمْ', u'وَكِتَِابياتهُمْ'],
 u'وكتابياتهن': [u'وَكِتَِابياتهِنَّ', u'وَكِتَِابياتهُنَّ', u'وَكِتَِابِيَاتِهِنَّ', u'وَكِتَِابِيَاتُهِنَّ', u'وَكِتَِابِيَاتُهُنَّ'],
 u'وللكتابات': [u'وَلِلْكِتَِابَاتِ', u'وَلِلْكِتَِابات'],
 u'أبكتابتكن': [u'أَبِكِتَِابَتِكُنَّ'],
 u'أبكتابتكم': [u'أَبِكِتَِابَتِكُمْ'],
 u'أكتابياتهن': [u'أَكِتَِابياتهِنَّ', u'أَكِتَِابِيَاتِهِنَّ', u'أَكِتَِابياتهُنَّ', u'أَكِتَِابِيَاتُهُنَّ', u'أَكِتَِابِيَاتُهِنَّ'],
 u'فكتاباتهم': [u'فَكِتَِاباتهِمْ', u'فَكِتَِابَاتُهُمْ', u'فَكِتَِابَاتُهِمْ', u'فَكِتَِاباتهُمْ', u'فَكِتَِابَاتِهِمْ'],
 u'بكتابياتكن': [u'بِكِتَِابِيَاتِكُنَّ', u'بِكِتَِابياتكُنَّ'],
....
}

Generate affixes lists

Alyahmor generate affixes listes for verbs and nouns

>>> verb_affix =generator.generate_affix_list(word_type="verb", vocalized=True)
>>>verb_affix
[u'أَفَسَت-يننِي', u'أَ-ونَا', u'ي-ونكَ', u'فَلَ-تاكَ', u'وَلََن-هُنَّ', u'أَت-وننَا', u'وَ-اكُنَّ', u'ن-ننَا', u'وَت-وهَا', u'أَي-نهُمَا', ....]

>>> noun_affix =generator.generate_affix_list(word_type="noun", vocalized=True)
>>> noun_affix
[u'أكَ-ياتكَ', u'فَ-ِيَاتِكُمَا', u'أكَ-ياتكِ', u'أَوَكَ-ِينَا', u'أَلِ-ِيِّهِنَّ', u'أَفَ-َكُمَا', u'أَفَ-ِيَّتِهِمْ', u'أَفَكَ-ياتهُمْ', u'فَبِ-ِيِّكُمْ', u'وَلِ-ِيَّتِهَا', ....]

Generate Unvocalized affixes

>>> noun_affix =generator.generate_affix_list(word_type="noun", vocalized=False)
>>> noun_affix
[u'-', u'-ا', u'-ات', u'-اتك', u'-اتكم', u'-اتكما', u'-اتكن', u'-اتنا', u'-اته', u'-اتها', ...]

Files

  • file/directory category description

tests/samples/dataset.csv A list of verified affixes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alyahmor-0.1.1.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

alyahmor-0.1.1-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file alyahmor-0.1.1.tar.gz.

File metadata

  • Download URL: alyahmor-0.1.1.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.19.9 CPython/2.7.12

File hashes

Hashes for alyahmor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 72f8562b9d407d32c45792f5c027a64e8eb74dbc202e3986f721f5ae19d4268b
MD5 9b0d4df081bfd64ed29e0d17ca768434
BLAKE2b-256 ec6f154e900daeb11fac2229aae9d9eb81d6bf88929b7920741b8bcbe4f9d5ea

See more details on using hashes here.

File details

Details for the file alyahmor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: alyahmor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.19.9 CPython/2.7.12

File hashes

Hashes for alyahmor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91a1b938cbc21819790e307a82eabeaa58f0cf278d0de62ecffdc09dad863528
MD5 81e7ec5c5cf552a8bb8e016d4cfdbec0
BLAKE2b-256 54a09ce7f24f20c03e8ed1fef0a738faa5abbc0fa259c7599b96856283240e7a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page