{"id":17718549,"url":"https://github.com/linuxscout/asmai-arabic-semantic","last_synced_at":"2025-05-08T07:36:22.946Z","repository":{"id":138754914,"uuid":"285676987","full_name":"linuxscout/asmai-arabic-semantic","owner":"linuxscout","description":"Asmai: Al'Asma'i arabic semantic  analyzer","archived":false,"fork":false,"pushed_at":"2024-09-02T16:26:47.000Z","size":10420,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T19:21:24.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linuxscout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"linuxscout"}},"created_at":"2020-08-06T21:42:12.000Z","updated_at":"2024-09-26T06:46:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f716da3-dc13-4e0a-ade1-a9543b679f96","html_url":"https://github.com/linuxscout/asmai-arabic-semantic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxscout%2Fasmai-arabic-semantic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxscout%2Fasmai-arabic-semantic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxscout%2Fasmai-arabic-semantic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxscout%2Fasmai-arabic-semantic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linuxscout","download_url":"https://codeload.github.com/linuxscout/asmai-arabic-semantic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253023722,"owners_count":21842303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-25T14:54:48.821Z","updated_at":"2025-05-08T07:36:22.927Z","avatar_url":"https://github.com/linuxscout.png","language":"Python","funding_links":["https://patreon.com/linuxscout"],"categories":[],"sub_categories":[],"readme":"# Asmai: (Al'asma'i) Arabic semantic analysis \n# مكتبة الأصمعي الدلالية\n\n\nAsmai: (Al'asma'i) Arabic semantic analysis library for Python\n\n![asmai logo](doc/asmai_header.png  \"asmai logo\")\n\n![PyPI - Downloads](https://img.shields.io/pypi/dm/asmai)\n\n  Developpers:  Taha Zerrouki: http://tahadz.com\n    taha dot zerrouki at gmail dot com\n\n  \nFeatures |   value\n---------|---------------------------------------------------------------------------------\nAuthors  | [Authors.md](https://github.com/linuxscout/asmai-arabic-semantic/master/AUTHORS.md)\nRelease  | 0.1\nLicense  |[GPL](https://github.com/linuxscout/asmai-arabic-semantic/master/LICENSE)\nTracker  |[linuxscout/asmai/Issues](https://github.com/linuxscout/asmai-arabic-semantic/issues)\nSource  |[Github](http://github.com/linuxscout/asmai-arabic-semantic)\nFeedbacks  |[Comments](https://github.com/linuxscout/asmai-arabic-semantic/)\nAccounts  |[@Twitter](https://twitter.com/linuxscout)\n\n## Description\n\nAsmai: (Al'asma'i) Arabic semantic analysis library for Python,  it provides extracting word pairs that carry meanings of the type: (subject-verb, verb-object, word composition)\n\n\n\n###  مزايا:\n* استخلاص ثنائيات الكلمات التي تحمل دلالات من نوع : (فاعلية، مفعولية، إضافة)\n\n\u003cdiv dir=\"rtl\"\u003e\n\n- \n\n\u003c/div\u003e\n\n### Usage\n\n#### import\n```python\npip install asmai\n```\n## Citation\n```bibtex\n@thesis{zerrouki2020adawat,\nauthor = {Taha Zerrouki},\ntitle = {Towards An Open Platform For Arabic Language Processing},\ntype = {PhD thesis},\ninstitution = {Ecole Nationale Supérieure d'informatique, Alger, Algérie},\ndate = {2020},\n}\n```\n#### Test \n```python\nimport asmai.anasem as asm\ntext  =  u\"يعبد الله منذ أن تطلع الشمس\"\nresult  =  []\nanasem  =  asm.SemanticAnalyzer()    \nresult  =  anasem.analyze_text(text)\n# the result contains objets\nanasem.pprint(result)\n```\n\n* Extract semantic relation, display only found relations\n\n```python\n\u003e\u003e\u003e import pprint\n\u003e\u003e\u003e sem_result = anasem.display_sem(result)\n\u003e\u003e\u003e pprint.pprint(sem_result)      \n[[['الشَّمْسُ', 'تَطْلُعَ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n  ['الشَّمْسُ', 'تَطْلُعُ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n  ['الشَّمْسُ', 'تَطْلُعْ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n  ['الشَّمْسُ', 'تَطْلَعَ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n  ['الشَّمْسُ', 'تَطْلَعُ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n  ['الشَّمْسُ', 'تَطْلَعْ', 'شَمْسٌ', 'طَلَعَ', 'Subject']]]\n\n```\n* Extract semantic relation, display all words and tags\n```python\n\u003e\u003e\u003e sem_result = anasem.display_sem(result, all=True)\n\u003e\u003e\u003e pprint.pprint(sem_result)\n[('يعبد', 'O', []),\n ('الله', 'O', []),\n ('منذ', 'O', []),\n ('أن', 'O', []),\n ('تطلع', 'B', []),\n ('الشمس',\n  'I',\n  [['الشَّمْسُ', 'تَطْلُعَ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n   ['الشَّمْسُ', 'تَطْلُعُ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n   ['الشَّمْسُ', 'تَطْلُعْ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n   ['الشَّمْسُ', 'تَطْلَعَ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n   ['الشَّمْسُ', 'تَطْلَعُ', 'شَمْسٌ', 'طَلَعَ', 'Subject'],\n   ['الشَّمْسُ', 'تَطْلَعْ', 'شَمْسٌ', 'طَلَعَ', 'Subject']])]\n\u003e\u003e\u003e \n```\n\n* convert to pandas\n```python\n\u003e\u003e\u003e import pandas as pd\n\u003e\u003e\u003e \n\u003e\u003e\u003e #  flatten the result\n... df = pd.DataFrame(anasem.decode(result))\n\u003e\u003e\u003e print(df.head())\n  action affix                          affix_key  forced_word_case  ...   unvocalized  unvoriginal  vocalized  word\n0         -ي--          -ي--|المضارع المنصوب:هو:y             False  ...          يعبد          عبد  يُعَبِّدَ  يعبد\n1         -ي--  -ي--|المضارع المجهول المجزوم:هو:y             False  ...          يعبد          عبد  يُعَبَّدْ  يعبد\n2         -ي--          -ي--|المضارع المجهول:هو:y             False  ...          يعبد          عبد  يُعَبَّدُ  يعبد\n3         -ي--          -ي--|المضارع المعلوم:هو:y             False  ...          يعبد          عبد  يُعَبِّدُ  يعبد\n4         -ي--          -ي--|المضارع المجزوم:هو:y             False  ...          يعبد          عبد  يُعَبِّدْ  يعبد\n\n[5 rows x 50 columns]\n\u003e\u003e\u003e df.to_csv(\"output/test.csv\", encoding=\"utf8\", sep=\"\\t\")\n\u003e\u003e\u003e \n\n```\n\n\n#### [requirement]\n  \n    1- pyarabic \n    2. sqlite\n    3. sylajone\n\n## Data Structure:\n\n### Semantic database\n```sql\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE \"derivations\" (\n    \"id\" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE ,\n    \"verb\" varchar NOT NULL ,\n    \"transitive\" BOOL NOT NULL  DEFAULT 1,\n    \"derived\" VARCHAR NOT NULL ,\n    \"type\" VARCHAR NOT NULL \n );\n```\n\nCSV Structure:\n\n* Derivattion\n \n1.   id             : id unique in the database\n2.  verb    : vocalized collocation\n3.  transtive : if the verb is transitive\n4.  derived         :  derived word from verb number\n5.  type    : type \n\n##### Semantic relations\n\n```sql \nCREATE TABLE \"relations\" (\n    \"id\" INTEGER PRIMARY KEY  NOT NULL ,\n    first\" VARCHAR NOT NULL  DEFAULT ('') ,\n    \"second\" VARCHAR NOT NULL  DEFAULT ('') ,\n    \"rule\" VARCHAR NOT NULL  DEFAULT (0) \n );\n```\n \n \nCSV Structure:\n\n1.   id             : id unique in the database\n2. first: first word\n3. second: second word\n4.  rule        : the extraction rule number\n        : \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxscout%2Fasmai-arabic-semantic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinuxscout%2Fasmai-arabic-semantic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxscout%2Fasmai-arabic-semantic/lists"}