How to write a program which can identify that who is the speaker in a text and what is he telling then I have to print "Speaker Name" and "The speech" on the screen like below. And if someone(assume Ram) says something, and in his speech another one (assume Sam) says something then I have to add it in 2 lines like-
Ram |
Sam |
The " | " just for showing the different between string like-
Speaker | Speech
Please see the example below to properly understand.
I have text file like this below-
==== START OF THE TEXT FILE ====
Ram said that he was a good boy.
Sam also said "I am also a good boy like Ram".
Ram asked Sam that where he wanted to do?
Sam replied that he wanted to do some thing but Naren his fiend said him to go to school, so he could not do the work.
====== END OF THE TEXT FILE ======
I have to make it like this in another text file-
======== START OF THE TEXT FILE ======
"Ram" | "said" | "that he was a good boy."
"Sam" | "also said" | "I am also a good boy like Ram".
"Ram" | "asked" | "Sam that where he wanted to do?"
"Sam" | "replied" | "that he wanted to do some thing but Naren his fiend said him to go to school, so he could not do the work."
"Naren" | "said" | "him to go to school"
======= END OF THE TEXT FILE ======
解决方案Create simple if else then statements and create array from them.
That should be enough info to solve the school project