简体   繁体   中英

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. 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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