问题描述
我像这样在数据集上应用了小写字母。我不认为问题是由这个引起的,但真正的问题是什么?
为什么我在这里得到 AttributeError: 'float' object has no attribute 'lower'
?
film_yorumları["text"] = film_yorumları["text"].str.lower()
完整代码:
from keras.preprocessing.text import Tokenizer
yorumlar=film_yorumları_temiz['text'].values.tolist()
puanlar=film_yorumları_temiz['tag'].values.tolist()
tokenizer_object=Tokenizer()
tokenizer_object.fit_on_texts(yorumlar)
#----------------------------------------------------------------------------------------------
max_length=max([len(s.split()) for s in yorumlar])
print(max_length) #76
vocab_size = len(tokenizer_object.word_index) +1
#print(vocab_size) #21888
x_train,x_test,y_train,y_test = train_test_split(yorumlar,puanlar,test_size=0.1)
#----------------------------------------------------------------------
x_train_token = tokenizer_object.texts_to_sequences(x_train)
x_test_token = tokenizer_object.texts_to_sequences(x_test)
#---------------------------------------------------------------------------------------------
x_train_pad = pad_sequences(x_train_token,maxlen=max_length,padding='post')
x_test_pad = pad_sequences(x_test_token,padding='post')
解决方法
你需要把它变成一个字符串。
$dbconfig['log_sql'] = true;