update to version 0.0.4
This commit is contained in:
parent
2094d90562
commit
957efb5012
@ -1,9 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
@author:XuMing(xuming624@qq.com)
|
@author:XuMing(xuming624@qq.com)
|
||||||
@description:
|
@description: 文本语义相似度计算和文本匹配搜索
|
||||||
This basic example loads a pre-trained model from the web and uses it to
|
|
||||||
compute cosine similarity for a given list of sentences.
|
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
@author:XuMing(xuming624@qq.com)
|
@author:XuMing(xuming624@qq.com)
|
||||||
@description: 文本语义相似度计算
|
@description: This basic example loads a matching model and use it to
|
||||||
|
compute cosine similarity for a given list of sentences.
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
@author:XuMing(xuming624@qq.com)
|
@author:XuMing(xuming624@qq.com)
|
||||||
@description:
|
@description: Fast similarity search demo
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -12,7 +12,7 @@ sim_model = WordEmbeddingSimilarity(wv_model)
|
|||||||
|
|
||||||
|
|
||||||
def ai_text(sentence1, sentence2):
|
def ai_text(sentence1, sentence2):
|
||||||
score = sim_model.similarity(sentence1, sentence2).numpy()[0][0]
|
score = sim_model.similarity(sentence1, sentence2)
|
||||||
print("{} \t\t {} \t\t Score: {:.4f}".format(sentence1, sentence2, score))
|
print("{} \t\t {} \t\t Score: {:.4f}".format(sentence1, sentence2, score))
|
||||||
|
|
||||||
return score
|
return score
|
||||||
|
Loading…
Reference in New Issue
Block a user