Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bidi.algorithm import get_display
- import os
- import matplotlib.pyplot as plt
- from wordcloud import WordCloud, STOPWORDS
- import arabic_reshaper
- f = open('quran-simple-enhanced.txt', 'r', encoding='utf-8')
- data = arabic_reshaper.reshape(f.read())
- data = get_display(data) # add this line
- stopwords = set(STOPWORDS)
- stopwords.add('مِنَ')
- stopwords.add('مِن')
- stopwords.add('مِنْ')
- WordCloud = WordCloud(font_path='Arial', background_color='white', mode='RGB', width=2000, height=1000, stopwords = stopwords, max_words=500).generate(data)
- plt.imshow(WordCloud)
- plt.axis("off")
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement