Python

【Python】asari感情分析でTypeError: object of type ‘generator’ has no len()のエラーが出た話

この記事は約2分で読めます。

 

エラー内容

 

先日Asariで感情分析を行っていたのですが、以下のエラーに遭遇しました

 

Traceback (most recent call last):
~~~

packages/sklearn/feature_extraction/text.py”, line 166, in _word_ngrams
n_original_tokens = len(original_tokens)
TypeError: object of type ‘generator’ has no len()

 

解決方法

 

Janomeを0.3.7にダウングレードしたところ解決しました。

 

$ pip install Janome==0.3.7

 

自分は下記の組み合わせで動作確認しました

Python 3.8.5
Janome 0.3.7
asari 0.0.4

 

関連記事:mecab-python で [ifs] no such file or directory: c:\mecab\mecabrc エラーが出た話

 

関連記事:【Python】Yahooのgooラボが提供している形態素解析APIを使って自然言語処理をしてみた

 

コメント

タイトルとURLをコピーしました