Skip to main content

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

Project description

ar_wordcloud

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

Installation:

  • $ pip install ar_wordcloud

Usage:

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

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.1.tar.gz (130.7 kB view details)

Uploaded Source

Built Distribution

ar_wordcloud-0.0.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ar_wordcloud-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8e1caf8937557e79161a5cbd7e6ec2ad3279319e2e272022dfc4fb04d437ad07
MD5 6e6c91a8c20de1ccb16678ef23b4aeb4
BLAKE2b-256 2d28b4a2e1837462a30a9de9e5c29b0d36a9bc36092cd375e174b39eaeefea1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ar_wordcloud-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e4366b02b2107f4945f9094a9469adc73af6d8ab9d50f7e16ed77055611c67ab
MD5 b8ff8badf95d15ef42811b5c8d82c4a1
BLAKE2b-256 88c47ccfe18442c0c8a6a48ac10df2613934aa1f1055c7ba6e27ef028f94eb64

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