Skip to main content

A tiny wrapper around `wordcloud.WordCloud` to support Arabic WordCloud

Project description

✨ May, 17 2020 ✨

ar_wordcloud

A tiny wrapper around wordcloud.WordCloud to support WordCloud with Arabic text.

Installation:

  • $ pip install ar_wordcloud

Usage:

Also, see the notebook example.

Import and instantiate the main class:

from ar_wordcloud import ArabicWordCloud

awc = ArabicWordCloud(background_color="white")

Then, either build a word cloud from a raw text string:

t = 'أهلاً وسهلا، اللغة العربية جميلة'
wc = awc.from_text(t)
wc.to_file('hello.png')

Or, build a word cloud from a dictionary:

d = {"مرحبا": 12, "برمج": 8, "من": 10, "رمضان كريم": 15, "العيد قرب": 12, "اهلين": 1, "كورونا": 3}
dict_wc = awc.from_dict(d, ignore_stopwords=True)
awc.plot(dict_wc, title="كل عام وانتم بخير", width=2, height=2)

Or, read text from a file:

wc = awc.from_file('examples/arabic.txt')
wc.to_file('examples/arabic.png')


TODO:

  • support mask plots
  • clean input text (remove punct .. etc)
  • support input from file e.g. awc.from_file(fname)
  • browse available fonts and select favorite
  • fix English font
  • cli support

PRs are welcome, thanks 🙏


Credit: this repo was born from the discussion in this PR.

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

ar_wordcloud-0.0.2.tar.gz (221.4 kB view details)

Uploaded Source

Built Distribution

ar_wordcloud-0.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file ar_wordcloud-0.0.2.tar.gz.

File metadata

  • Download URL: ar_wordcloud-0.0.2.tar.gz
  • Upload date:
  • Size: 221.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.18.4

File hashes

Hashes for ar_wordcloud-0.0.2.tar.gz
Algorithm Hash digest
SHA256 327a95a860ae73213dc958dbe9e7cf1f75b6909f569c48b6ec3d208660610ec9
MD5 930b7ea536908432f1851dab7b198e46
BLAKE2b-256 950de551513c993a603cf7f67707f36a5d22e3e8a2227cc850881450e9ba6f0b

See more details on using hashes here.

File details

Details for the file ar_wordcloud-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ar_wordcloud-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2b385ce1f99758f5e8cb16f60f6aaee047c932247c41322f7563e0bd00cda785
MD5 65e59fd478723a182aef44bc1a724a6e
BLAKE2b-256 08c9d034a90947dfd387c9718f2ac5084019eca0a59ae9d348a3b09d55ce7a16

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