“ polyglot.text”返回“ ModuleNotFoundError:没有名为'polyglot.text'的模块”错误

问题描述

我运行了这段代码,但是即使安装了polyglot,它仍然不断给我这个错误。我还需要安装其他软件包吗?

  from polyglot.text import Text

     # Creating functions
     def count_positive_words(article_text):
        positive_words_count = 0
    
        try:
            text = Text(article_text)
        
            for w in text.words:
                if w.polarity==1:
                    positive_words_count+=1
        except:
            positive_words_count = np.nan
        
        return positive_words_count
    -
     ModuleNotFoundError                       Traceback (most recent call 
    last)
    <ipython-input-99-bcb6568ca7ff> in <module>()
          1 ####################################################### Sentiment 
    ##############################################################
    ----> 2 from polyglot.text import Text
          3 
          4 # Creating functions
         5 def count_positive_words(article_text):
     ModuleNotFoundError: No module named 'polyglot.text'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)