def getSimilarVectors(index, number, sentence_index, q_embedding_vectors):
vector = q_embedding_vectors[sentence_index]
query_doc = {
"size" : number,
"query": {
"script_score": {
"query" : {
"match_all" : {}
},
"script": {
"source": "cosineSimilarity(params.query_vector, 'sent_vec') + 0.5",
"params": {
"query_vector": vector
}
}
}
}
}
sentences = []
search_result = es.search(index = index, body = query_doc)
qu嵌入向量是一个大小为768的列表,由句子嵌入组成。我想在考虑两个向量(q\u embedding\u vectors\u 1,q\u embedding\u vectors\u 2)代替q\u embedding\u vectors时得到一个相似的向量,因为当有三个向量时,余弦相似性度量失败,有没有度量来解决我的查询问题?
暂无答案!
目前还没有任何答案,快来回答吧!