简体   繁体   English

如何在 Python 中将直接语音转换为间接语音?

[英]How can I convert convert Direct speech to Indirect Speech in Python?

I am working on a project to create summaries from call transcripts utilizing Extractive Summarization.我正在开展一个项目,利用提取摘要从通话记录中创建摘要。 Since extractive summarization is picking key sentences from call transcripts they are in direct speech.由于提取摘要是从通话记录中挑选关键句子,因此它们是直接语音。

Example:例子:

"I am facing issue with my laptop and I would like to get it replaced" to "Customer was facing issue with laptop and he would like to get his laptop replaced" “我的笔记本电脑遇到问题,我想更换它”到“客户遇到笔记本电脑的问题,他想更换他的笔记本电脑”

I have tried looking for various resources, code or Library and the only thing that comes closest is one python library "Despeech" https://pypi.org/project/despeech/ but it is for German Language.我尝试寻找各种资源、代码或库,唯一最接近的是一个 Python 库“Despeech” https://pypi.org/project/despeech/,但它是针对德语的。 I am unable to find something similar for English language.我找不到类似的英语语言。

Indirect speech is saying "I would like to get it replaced" instead of saying directly "replace it".间接引语是说“我想更换它”,而不是直接说“更换它”。 So this is not indirect speech , but perspective taking .所以这不是间接引语,而是透视

To do so, you must first interpret the text into a more semantic-oriented structure, distinguishing the subjects, the pronouns and the verbs in the propositions.为此,您必须首先将文本解释为更面向语义的结构,区分命题中的主语、代词和动词。 Universal dependencies are the adequate format for representing that.通用依赖是表示它的适当格式。 NLTK alone cannot extract them directly, but it can work it out with Stanford CoreNLP .单独的 NLTK 不能直接提取它们,但它可以与 Stanford CoreNLP 一起解决

Then, you must replace the target (here, the first person subject) and all its coreferences accordingly.然后,您必须相应地替换目标(此处为第一人称主题)及其所有共指。

Finally, it should not be too hard to generate the output text from the updated dependencies.最后,从更新的依赖项生成输出文本应该不会太难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM