如何提取与示例句子列表相比具有相似含义/意图的句子

问题描述 投票:1回答:1

我在客户和顾问之间进行了聊天互动[对话],并且想知道顾问互动是否包含下面列表中的特定句子或类似句子:

[我正在顾问互动中寻找的例句

["I would be more than happy to help you with this",
"I would be happy to look over the account to see how I can help get this sorted out for you",
"I’d be more than happy to look into this for you!",
"Oh, I see, let me assist you with this concern.",
"I am more than happy to do everything I can to resolve this matter for you.",
"I would be happy to look over the account to see how I can help get this sorted out for you.",
"I am happy to have a look."]


I have a dataset which contains the list of interaction_id and Utterances(Sample below)

```Example Chat interaction between Advisor and CLient : 
Client : Hello I would like to place an order for replacement battery
Agent: Hi Welcome to Battery service department. I would be happy to help you with your battery replacement Order.

如何获取/提取具有相似意图或含义的句子。我是NLP的新手,我认为我手头有一个句子分类/提取问题,想知道有什么方法可以实现我所需要的]

基本上我正在尝试实现以下目标:

ID    Utt                                               Help_Stmt_Present

IRJST   Hi Welcome to Battery service department. 
        I would be happy to help you with your battery
        replacement Order.                                     Yes 


python-3.x nlp gensim doc2vec sentence-similarity
1个回答
0
投票

可以采用多种方法在多个步骤中执行此操作:1。计算句子向量

a。使用预训练的单词嵌入(手套,word2vec,fasttext等)并为每个单词计算单词嵌入,然后将其平均到句子的单词中,以计算句子的嵌入。b。使用Universal Sentence Encoder获取句子嵌入。

2。计算相似度匹配

a。使用欧几里得或余弦或其他最适合您的问题的距离度量,计算目标与所有其他N个句子之间的距离。b。使用您拥有的N个句子向量训练KNN模型,并对目标句子应用K-NN预测以获得K个最相似的句子。

为了获得更好的结果,您可以使用基于深度学习的技术和SOTA体系结构,例如变压器及其之上构建的体系结构。您可以签出this repository,这可以使用变压器解决您的任务。同样,要使用不同的体系结构和其他NLP任务,您可以签出Hugging Face Repository

© www.soinside.com 2019 - 2024. All rights reserved.