Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 03, 2016, 11:52:08 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Sort (and split) text by user-added (tag) strings in front of paragraphs  (Read 2504 times)

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
The idea is to be able to gather paragraphs that have the same kind of content together for further editing.

Example: you've collected paragraphs of text dealing with several different topics into a single file, but they are in random order. To get them in order, you read each paragraph just enough to determine what it's about and add a tag. After you're done, you run this program and you've got all the tagged ones neatly together, in the same order as they were in the original text.

Huge messy text file:

Something about zeros 1.
Something about ones 1.
Something about ones 2.

Something about zeros 2.
Something about zeros 3.


Something about ones 3.

Something about zeros 4.


The user manually adds a tag to the beginning of each paragraph - to make it easy using perhaps some auto string expander, typing e.g. zzero, oone, or +z, +o:

[Zero] Something about zeros 1.
[One] Something about ones 1.
[One] Something about ones 2.

[Zero] Something about zeros 2.
[Zero] Something about zeros 3.


[One] Something about ones 3.

[Zero] Something about zeros 4.


The software sorts the paragraphs so that all paragraphs that have the same tag are together. It can export them into files that have the tag as a name (optionally without the special characters, like []):

[Zero] Something about zeros 1.
[Zero] Something about zeros 2.
[Zero] Something about zeros 3.
[Zero] Something about zeros 4.

[One] Something about ones 1.
[One] Something about ones 2.
[One] Something about ones 3.


(Notice the zeros were first, because the first occurrence of a tag was a zero.)


Options:

The tag as a subtitle before the paragraphs with optionally one or two empty lines above it and one, two or none below.
Add empty line between paragraphs.
Don't remove the tags from the result.
Sort tags alphabetically (the ones would be first).
The tag can be anywhere within the paragraph.


The tags could of course be anything, like -z and -o. The software determines it's a tag if two instances of the same string appear in front of paragraphs.


« Last Edit: June 30, 2009, 11:21:15 AM by tmpusr »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,275
    • View Profile
    • Miles Ahead Software
    • Donate to Member
I didn't use vi much when I was messing around with Linux, but I tried it enough to be surprised if vim wouldn't be able to do something like this.  The paragraph manipulation is much more powerful than most editors we're used to on Windows.  And I believe it's a freebie.

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
How about making it easier:

If the first string of the paragraph is equal to any of the lines in a text file (containing the tags), append the paragraph and optionally the following paragraphs until the next tag to a file by that name and optionally remove the appended text from the original file.

A snack, eh?
« Last Edit: July 02, 2009, 04:12:48 PM by tmpusr »