Ai
1 Star 0 Fork 1

Pasca/bert_textMatching

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
intent.py 724 Bytes
一键复制 编辑 原始数据 按行查看 历史
mingpeng617 提交于 2019-03-13 14:40 +08:00 . first commit
from predict import predicts
sentences = [['长的清新是什么意思', '小清新的意思是什么']]
for sentence in sentences:
dic = predicts([sentence])
print(dic)
file = open('data/test.txt', 'r')
f = open('data/erro.txt', 'w')
sentences = []
tag = []
for line in file.readlines():
data = line.replace("\n", "").split("\t")
sentences.append([data[0], data[1]])
tag.append(data[2])
resule = predicts(sentences)
erro = 0
for x in range(len(resule)):
if resule[x][0] != tag[x]:
erro += 1
print(sentences[x])
f.writelines(sentences[x][0]+"\t"+sentences[x][1]+"\t"+resule[x][0]+"\t"+str(resule[x][1])+"\n")
print("test数据集的accuracy为:"+str(1-erro/len(resule)))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Samuelcoding/bert_textMatching.git
git@gitee.com:Samuelcoding/bert_textMatching.git
Samuelcoding
bert_textMatching
bert_textMatching
master

搜索帮助