问题描述
这是一个生成阿拉伯诗歌的HTML页面。
<table>
<tr>
<th></th>
<td><pre>{{poemm}}</pre></td>
<td><pre>{{poem}}</pre></td>
</tr>
</table>
我想从表格中检索生成的诗并将其用于预测过程,但我不知道如何做。我搜索后发现我需要使用申请表,但是我不知道表格中的内容。
这是我的预测过程代码:
elif request.form['action'] == 'Classify':
train = pd.read_excel('/home/sirina/Desktop/Project/Corpus2/Two-versed Poems/corpusTwoColumnsTrain.xlsx')
Quasida = [' '.join([x,y]) for x,y in zip(train.Sader,train.Ajez)]
count_vect = CountVectorizer()
X_train_counts = count_vect.fit_transform(Quasida)
tfidf_transformer = TfidfTransformer()
X_train_tfidf = tfidf_transformer.fit_transform(X_train_counts)
clf = LinearSVC().fit(X_train_tfidf,train.Era)
#here i need the poem that i generated to predicted
predicted=clf.predict(count_vect.transform(poem))
return render_template('testt.html',poem=poem,prediction=predicted[0])
return render_template('testt.html')
PS:我需要从表中同时检索诗和诗。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)