Click here to Skip to main content
15,894,297 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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 | <Whole Speech of Ram including Sam>
Sam | <Speech>
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 ======
Posted
Updated 30-Sep-15 6:04am
v3
Comments
Richard MacCutchan 30-Sep-15 12:34pm    
What have you tried, and where are you stuck? If this is your college/school assignment then you need to make an effort to do the work.

1 solution

Create simple if else then statements and create array from them.
That should be enough info to solve the school project
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900