Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70606 > unrolled thread

Re: how to split this kind of text into sections

Started byTerry Reedy <tjreedy@udel.edu>
First post2014-04-25 13:52 -0400
Last post2014-04-25 13:52 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: how to split this kind of text into sections Terry Reedy <tjreedy@udel.edu> - 2014-04-25 13:52 -0400

#70606 — Re: how to split this kind of text into sections

FromTerry Reedy <tjreedy@udel.edu>
Date2014-04-25 13:52 -0400
SubjectRe: how to split this kind of text into sections
Message-ID<mailman.9502.1398448424.18130.python-list@python.org>
On 4/25/2014 9:07 AM, oyster wrote:
> I have a long text, which should be splitted into some sections, where
> all sections have a pattern like following with different KEY.

Computers are worse at reading your mind than humans. If you can write 
rules that another person could follow, THEN we could help you translate 
the rules to Python.

If you have 1 moderate length file or a few short files, I would edit 
them by hand to remove ignore lines and put a blank line between 
sections. A program to do the rest would then be easy.

> the above text should be splitted as a LIST with 3 items, and I also
> need to know the KEY for LIST is ['I am section', 'let's continue', 'I
> am using']:

This suggests that the rule for keys is 'first 3 words of a line, with 
contractions counted as 2 words'. Correct?

Another possible rule is 'a member of the following list: ...', as you 
gave above but presumably expanded.

-- 
Terry Jan Reedy

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web