現在感情分析ライブラリであるasariを使ったポジネガ分類をやろうとしています。
(参考URL:https://note.com/natto_nebaneba/n/n48ed3daa1745)
しかし、以下のエラー文が出てできません。
Traceback (most recent call last):
File "posinega_pred_v02.py", line 33, in <module>
print(sonar.ping("さすがディオ!おれたちにできない事を平然とやってのけるッ そこにシビれる! あこがれるゥ!"))
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/asari/api.py", line 27, in ping
vector = self.preprocessor.transform([text])
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py", line 1680, in transform
X = super().transform(raw_documents)
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py", line 1112, in transform
_, X = self._count_vocab(raw_documents, fixed_vocab=True)
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py", line 970, in _count_vocab
for feature in analyze(doc):
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py", line 352, in <lambda>
tokenize(preprocess(self.decode(doc))), stop_words)
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-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()
調べてみても同様のエラーが出たというケースがないようで詰まっております。。。。
python
import db import pandas as pd import numpy as np import pymysql.cursors import asari from asari.api import Sonar def get_positive_power(text): info = sonar.ping(text= text) posi_vector = info["classes"][1]["confidence"] return posi_vector sonar = Sonar() print(get_positive_power("さすがディオ!おれたちにできない事を平然とやってのけるッ そこにシビれる! あこがれるゥ!"))
まだ回答がついていません
会員登録して回答してみよう