yanqiangmiffy / sentence-similarity Goto Github PK
View Code? Open in Web Editor NEW问题句子相似度计算,即给定客服里用户描述的两句话,用算法来判断是否表示了相同的语义。
问题句子相似度计算,即给定客服里用户描述的两句话,用算法来判断是否表示了相同的语义。
你好,我看了您得源码。既然模型定义输入两个问题对[left,right],输出的是经过隐藏层的曼哈顿距离distance,为什么可以直接用文本相似的标签Y作为模型训练的label呢?具体distance与标签y是如何关联起来的呢?麻烦指点下,谢谢
请教下没抛异常的童靴们。。。
你们keras和tf的版本是怎样的,十分感谢
# 原max_length选择方法,逻辑有问题
# for i in len_dict:
# rate = i[1] / all_sent
# cover_rate += rate
# if cover_rate >= limit_ratio:
# max_length = i[0]
# break
分析:len_dict是句子长度的频数统计list[(15,3700),(12,2800),(8,500)...(20,30)],每个元素(句长,频数)
按上述逻辑,当3700+2800+500大于总频数95%时,max_len是8,这里就产生了错误。
应该修改为:
temp = sorted(len_dict, key=lambda x:x[0], reverse=False)
for i in temp:
rate = i[1] / all_sent
cover_rate += rate
if cover_rate >= limit_ratio:
max_length = i[0]
break
这个模型我训练出来了,但是我想将这个模型用在问答系统中做qq-match的模型,就是输入一句话,在一堆问题中找到和这个输入最相近的问题,请问怎么利用这个模型?谢谢
就是计算的相似度(0到1之间),当它大于多少的时候,我们认为这两个句子是相似的呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.