【问题标题】:Bangla text word cloud孟加拉语文本词云
【发布时间】:2021-11-15 17:07:19
【问题描述】:

我想把孟加拉语文本的词云拿出来,但是打印的时候,每个单词的辅音都是分开打印的。

data = pd.read_csv('/content/gdrive/MyDrive/data.csv',encoding='UTF-8')
refined_sentence = " ".join(data)
regex = r"[\u0980-\u09FF]+"
wc = WordCloud(width=800, height=400, mode="RGBA",background_color=None, colormap="hsv", 
stopwords = stopwords, font_path="kalpurush.ttf", regexp=regex).generate(refined_sentence)
plt.figure(figsize=(7, 7))
plt.imshow(wc, interpolation='none')
plt.axis("off")
plt.show()

【问题讨论】:

    标签: jupyter-notebook nlp word-cloud bangla-font


    【解决方案1】:

    我关注了this comment,最终可以在Ubuntu中解决问题。

    第 1 步:!sudo apt-get install libfreetype6-dev libharfbuzz-dev libfribidi-dev gtk-doc-tools

    第 2 步:!wget -O raqm-0.7.0.tar.gz https://raw.githubusercontent.com/python-pillow/pillow-depends/master/raqm-0.7.0.tar.gz

    现在 raqm-0.7.0.tar.gz 文件应该在您的下载部分。

    第 3 步:!tar -xzvf raqm-0.7.0.tar.gz

    第 4 步:!cd raqm-0.7.0

    第 5 步:!./configure --prefix=/usr && make -j4 && sudo make -j4 install

    第 6 步:现在您只需重新安装 Pillow 库。激活正确的环境。然后运行以下命令:

    python3 -m pip install --upgrade pip python3 -m pip install --upgrade Pillow

    就是这样!现在你有一个工作的 Pillow 库,可以在图像中生成适当的孟加拉语和其他印度字体。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-06
      • 1970-01-01
      • 2015-04-17
      相关资源
      最近更新 更多