islander
islander

Reputation: 53

Split block of text into separate parts

New to R so apolgies if this is obvious.. Given a text document containing a sample block of text such as the following:

Deputy Kermit: Sir, providing access to good education for all the Utoppia's children is one of our most important responsibilities as States’ Members. We all recognise that. On the morning we began to debate the future of selection in secondary education that was why feelings ran so high, and why it was so closely fought.

But our responsibility does not stop at the doors of this Assembly. For the sake of practicality we delegate day-to-day policy responsibilities to individual Committees. As Deputy Fozzy has rightly said, the Committee is the agent of the States. Ultimately it should do what it is told. So there should be no doubt that the buck stops with us, the States, to be sure that our agent, the Committee, has the skills, strength and experience necessary for the task we have assigned to it. If the Committee is not the right one for the task ahead, especially if it is a task of vital importance to our Island, then it is our duty to deal with that. We must remember that there is no hierarchy here, no power to hire or fire discreetly in this Assembly. If a Committee is in the wrong job but it does not step down, the only tool we have to manage that is a motion of no confidence.

Deputy Fozzy’s record too is similar, he just said that change is a recipe for disaster. On the steps of the States after December’s debate he told us that Utopia would rue – The Bailiff: Deputy Fozzy.

Deputy Fozzy: That was never said on the steps of this Assembly after the debate. I have said nothing ever like that after the debate. I think you need to check your facts. The Bailiff: Through the Chair, Deputy Kermit: I repeat what I heard in the media, sir.

I would like to split each speakers statements out into their own separate file. What are my options to do this, given the speakers title (in this example Deputy or Baliff) and the character ':' may also occur within the block of text?

Upvotes: 1

Views: 56

Answers (1)

miraliu
miraliu

Reputation: 31

Not sure about the sentence breaks here...just an attempt.

Regex:

    (^|[\W\S]\s*)(([A-Z][a-z]+\s?)+:)

Replacement:

    $1\n\n$2

Output:

Deputy Kermit: Sir, providing access to good education for all the Utoppia's children is one of our most important responsibilities as States’ Members. We all recognise that. On the morning we began to debate the future of selection in secondary education that was why feelings ran so high, and why it was so closely fought. But our responsibility does not stop at the doors of this Assembly. For the sake of practicality we delegate day-to-day policy responsibilities to individual Committees. As Deputy Fozzy has rightly said, the Committee is the agent of the States. Ultimately it should do what it is told. So there should be no doubt that the buck stops with us, the States, to be sure that our agent, the Committee, has the skills, strength and experience necessary for the task we have assigned to it. If the Committee is not the right one for the task ahead, especially if it is a task of vital importance to our Island, then it is our duty to deal with that. We must remember that there is no hierarchy here, no power to hire or fire discreetly in this Assembly. If a Committee is in the wrong job but it does not step down, the only tool we have to manage that is a motion of no confidence. Deputy Fozzy’s record too is similar, he just said that change is a recipe for disaster. On the steps of the States after December’s debate he told us that Utopia would rue –

The Bailiff: Deputy Fozzy.

Deputy Fozzy: That was never said on the steps of this Assembly after the debate. I have said nothing ever like that after the debate. I think you need to check your facts.

The Bailiff: Through the Chair,

Deputy Kermit: I repeat what I heard in the media, sir.

Upvotes: 1

Related Questions