SHARE
TWEET

Untitled

a guest Jun 27th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from bidi.algorithm import get_display
  2. import os
  3. import matplotlib.pyplot as plt
  4. from wordcloud import WordCloud, STOPWORDS
  5. import arabic_reshaper
  6.  
  7.  
  8. f = open('quran-simple-enhanced.txt', 'r', encoding='utf-8')
  9. data = arabic_reshaper.reshape(f.read())
  10. data = get_display(data) # add this line
  11.  
  12. stopwords = set(STOPWORDS)
  13. stopwords.add('مِنَ')
  14. stopwords.add('مِن')
  15. stopwords.add('مِنْ')
  16. WordCloud = WordCloud(font_path='Arial', background_color='white', mode='RGB', width=2000, height=1000, stopwords = stopwords, max_words=500).generate(data)
  17.  
  18.    
  19. plt.imshow(WordCloud)
  20. plt.axis("off")
  21. plt.show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top