{"id":16393474,"url":"https://github.com/iamaziz/ar_wordcloud","last_synced_at":"2025-03-23T04:31:50.462Z","repository":{"id":57411703,"uuid":"264717399","full_name":"iamaziz/ar_wordcloud","owner":"iamaziz","description":"A tiny wrapper for Arabic WordCloud plots","archived":false,"fork":false,"pushed_at":"2020-05-24T23:44:07.000Z","size":1009,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T17:57:29.424Z","etag":null,"topics":["arabic-wordcloud","matplotlib","wordcloud"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamaziz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-17T17:10:43.000Z","updated_at":"2024-04-09T05:05:35.000Z","dependencies_parsed_at":"2022-08-27T17:11:10.858Z","dependency_job_id":null,"html_url":"https://github.com/iamaziz/ar_wordcloud","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/iamaziz%2Far_wordcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamaziz%2Far_wordcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamaziz%2Far_wordcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamaziz%2Far_wordcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamaziz","download_url":"https://codeload.github.com/iamaziz/ar_wordcloud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"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":["arabic-wordcloud","matplotlib","wordcloud"],"created_at":"2024-10-11T04:53:20.023Z","updated_at":"2025-03-23T04:31:49.708Z","avatar_url":"https://github.com/iamaziz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"right\" style=\"text-align: right\"\u003e\u003ci\u003e\u003csup\u003e✨ May, 17 2020 ✨\u003c/sup\u003e\u003c/i\u003e\u003c/div\u003e\n\n# ar_wordcloud\n[![PyPI version](https://badge.fury.io/py/ar_wordcloud.svg)](http://badge.fury.io/py/ar_wordcloud)\n\nA tiny wrapper around [`wordcloud.WordCloud`](https://github.com/amueller/word_cloud/blob/master/wordcloud/wordcloud.py#L154) to support WordCloud with Arabic text.\n\n### Installation:\n\n- `$ pip install ar_wordcloud`\n\n### Usage:\n\n\u003e Also, see the [notebook](examples/how_to.ipynb) example.\n\nImport and instantiate the main class:\n```python\nfrom ar_wordcloud import ArabicWordCloud\n\nawc = ArabicWordCloud(background_color=\"white\")\n```\nThen, either build a word cloud from a raw text string:\n```python\nt = 'أهلاً وسهلا، اللغة العربية جميلة'\nwc = awc.from_text(t)\nwc.to_file('hello.png')\n```\n![](examples/hello.png)\n\nOr, build a word cloud from a dictionary:\n```python\nd = {\"مرحبا\": 12, \"برمج\": 8, \"من\": 10, \"رمضان كريم\": 15, \"العيد قرب\": 12, \"اهلين\": 1, \"كورونا\": 3}\ndict_wc = awc.from_dict(d, ignore_stopwords=True)\nawc.plot(dict_wc, title=\"كل عام وانتم بخير\", width=2, height=2)\n```\n![](examples/happy_eid.png)\n\nOr, read text from a file:\n\n```python\nwc = awc.from_file('examples/arabic.txt')\nwc.to_file('examples/arabic.png')\n```\n![](examples/arabic.png)\n\n\u003chr\u003e\n\n## Using a mask\n\nAlso, you can use a mask:\n\n```python\nfrom ar_wordcloud import ArabicWordCloud\nfrom ar_wordcloud.utils import read_mask_image\n\nmask_img = read_mask_image() # NOTE: pass `mask_img_url` param to use a different mask, the default is a heart \nawc = ArabicWordCloud(background_color=\"white\", mask=mask_img, contour_width=4, scale=0.5)\n\nawc.from_file('examples/arabic.txt').to_image()\n```\n\n![](examples/heart_mask.png)\n\n\u003chr\u003e\n\n## Multiple fonts support\n\nIt's also possible to choose a different Arabic font:\n\n```python\nfrom ar_wordcloud import ArabicWordCloud\n\nawc = ArabicWordCloud(font='NotoSansArabic-ExtraBold.ttf')\n\nt = f\"عيدفطر2020 سعيد، كل عام وانتم بخير\"\nawc.from_text(t).to_image()\n```\n\n![](examples/more_fonts.png)\n\n```python\n# To see the available fonts:\nprint(awc.fonts.available_fonts)\n```\n\n\u003e If the entered font name is not correct, there'll be a friendly assertion message:\n\n```bash\nAssertionError: بالله أتأكد ان اسم الخط المُدخل صحيح\nPlease make sure the selected font name is correct!\n```\n\n\u003chr\u003e\n\nTODO:\n- [x] support mask plots\n- [ ] clean input text (remove punct .. etc)\n- [x] support input from file e.g. `awc.from_file(fname)`\n- [x] browse available fonts and select favorite\n- [ ] fix English font\n- [ ] cli support\n\nPRs are welcome, thanks 🙏\n\n\u003chr\u003e\n\nCredit: this repo was born from [the discussion in this PR](https://github.com/amueller/word_cloud/pull/315).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamaziz%2Far_wordcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamaziz%2Far_wordcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamaziz%2Far_wordcloud/lists"}