基于pytorch的文本情感识别(LSTM,CNN) | 您所在的位置:网站首页 › 中文文本情感分析代码 › 基于pytorch的文本情感识别(LSTM,CNN) |
基于pytorch的文本情感识别(LSTM,CNN)
乐尤:
ValueError Traceback (most recent call last)
Cell In[118], line 1
----> 1 X_train = text_to_index_array(index_dict, X_train_l)
2 X_test = text_to_index_array(index_dict, X_test_l)
3 #print("训练集shape: ", X_train[0])
Cell In[112], line 16, in text_to_index_array(p_new_dic, p_sen)
14 new_sen.append(0) # 索引字典里没有的词转为数字0
15 new_sentences.append(new_sen)
---> 16 return np.array(new_sentences) # 转numpy数组
17 else:
18 new_sentences = []
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (6212,) + inhomogeneous part.
这个问题怎么解决啊 求大佬帮忙 weixin_44629522: 测试集测试完成后,如何进行新样本的情感分析呢 基于pytorch的文本情感识别(LSTM,CNN)大九九: output = open('F:/python_data/practice/tansongbo/dict.txt' + ".pkl", 'wb')这个dict.txt是什么啊,请问有大佬解答一下吗? 基于pytorch的文本情感识别(LSTM,CNN)wxs..: 还真都是100% 有朋友知道为什么吗 基于pytorch的文本情感识别(LSTM,CNN)fytto: gensim_dict.doc2bow(list(model.wv.key_to_index.keys()), allow_update=True) 换成这个 |
CopyRight 2018-2019 实验室设备网 版权所有 |