I tried the code below :
!pip install python-bidi
from wordcloud import WordCloud
from matplotlib import pyplot as plt
from bidi.algorithm import get_display
text="""মুস্তাফিজ"""
bidi_text = get_display(text)
print(bidi_text)
# https://github.com/amueller/word_cloud/issues/367
# https://stackoverflow.com/questions/54063438/create-wordcloud-in-python-for-foreign-language-hebrew
# https://www.omicronlab.com/bangla-fonts.html
rgx = r"[\u0980-\u09FF]+"
wordcloud = WordCloud(font_path='/content/Siyamrupali.ttf').generate(bidi_text)
#wordcloud = WordCloud(font_path='/content/FreeSansBold.ttf').generate(bidi_text)
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
plt.show()
then i get this error :
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-87-56d899c0de07> in <module>()
12 # https://www.omicronlab.com/bangla-fonts.html
13 rgx = r"[\u0980-\u09FF]+"
---> 14 wordcloud = WordCloud(font_path='/content/Siyamrupali.ttf').generate(bidi_text)
15
16 #wordcloud = WordCloud(font_path='/content/FreeSansBold.ttf').generate(bidi_text)
2 frames
/usr/local/lib/python3.6/dist-packages/wordcloud/wordcloud.py in generate_from_frequencies(self, frequencies, max_font_size)
381 if len(frequencies) <= 0:
382 raise ValueError("We need at least 1 word to plot a word cloud, "
--> 383 "got %d." % len(frequencies))
384 frequencies = frequencies[:self.max_words]
385
ValueError: We need at least 1 word to plot a word cloud, got 0.
this line is not picking bangla words : wordcloud = WordCloud(font_path='/content/Siyamrupali.ttf').generate(bidi_text)
i tried almost all the fonts from here for bangla language : https://www.omicronlab.com/bangla-fonts.html
nothing works