Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement