Topic: Dual columns and column block insertion (1 of 13), Read 43 times
Conf: Basic editing, Block operations
From: John H
Date: Sunday, February 06, 2005 12:57 PM

Hi,

first off, let me say happy, belated new year!

I've a task at hand that columnar blocks should help greatly with,
but have hit a roadblock and can't completely understand via the
help if this is just something I have to deal with or what.

I have an ASCII file which is formatted in pages like so:

aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaa[ 1 ]aaaaa bbbbb[ 2 ]bbbbb <-- imagine this is aligned with the others :-)
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb

aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
etc..

the data isn't as cleanly aligned as the above, some lines and/or
pages 'aa..' and 'bb..' are separated at a different col. positions.

Anyhow I need to bring column [2] below column [1], pushing the next
page of cols [1] & [2] data down. Basically to convert multi-column
data to single column data on a page by page basis.

The [2] column however is overwriting, as anticipated, the data
below the .

I figured before I wrote a macro (a bit out of practice) I would ask
if there is some tweak to insert a column block.

--
John
VEDIT SN: 95651
VEDIT (DOS) Ver. 6.12.1 05/24/04
VEDIT (32-Bit) Ver. 6.12.1 05/24/04
VEDIT Pro (64-Bit) Beta Test Ver. 6.12.1 05/24/04
Windows 2000 (5.0.2195 Service Pack 4)

 


Topic: Dual columns and column block insertion (2 of 13), Read 39 times
Conf: Basic editing, Block operations
From: Ian Binnie
Date: Sunday, February 06, 2005 09:38 PM

On 2/6/2005 12:57:24 PM, John H wrote:
>The [2] column however is
>overwriting, as anticipated,
>the data
>below the .

I assume that you have selected the 1st page of b's than pasted it below the 1st page of a's.

This is what I get:-

aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaa[ 1 ]aaaaa <-- imagine this is aligned with the others :-)
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
bbbbb[ 2 ]bbbbbetc..
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb

This is obviously not what you want.

The approach I have used in the past is to copy the text into a new buffer.

E.g. select 1st a page, copy to new buffer.
select 1st b page, append to buffer.

I will leave the coding as an exercise for the student (the hard part is detecting your blocks). Depends how often you need to do this.

If I was coding a macro I would proceed:-
Select 1st a page, copy to text register 21
Select 1st b page, copy to text register 22
Switch buffers, append text register 21, append text register 22.
Clear registers.
Return to original buffer & repeat.

One other option is to copy all pages of a's to a buffer, then all b's to another and merge them page by page

 


Topic: Dual columns and column block insertion (3 of 13), Read 39 times
Conf: Basic editing, Block operations
From: John H
Date: Monday, February 07, 2005 02:09 AM

On Sun, 6 Feb 2005 21:38:20 -0500 GMT, Ian Binnie wrote:

> I assume that you have selected the 1st page of b's than pasted it
> below the 1st page of a's.

> This is what I get:-

Yes, that is also how it turns out here.

> This is obviously not what you want.

Correct. I'm sure you follow what I am/was trying to do, but in sake
of clarity I am wanting to change:

aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb

aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
etc..

..to:

aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa

bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb

aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
etc..

> The approach I have used in the past is to copy the text into a
> new buffer.

> E.g. select 1st a page, copy to new buffer.
> select 1st b page, append to buffer.

Yes, that is where I seem to be headed unless of course there does
happen to be an overlooked way to 'insert' the column block using
the ALT-I -> CTL-C -> Paste Columnar Clipboard -- tedious I know but
the data is going to require a lot of eyeballing anyhow.

> I will leave the coding as an exercise for the student (the hard
> part is detecting your blocks). Depends how often you need to do
> this.

This project alone is about 140 pages of dual column data. It's
some old data I acquired by means of OCR and now need to process it
further so I can import it into a database. I don't know if I'll
ever have to do this again, hopefully I can resist getting too
involved making a macro that I don't forget to just process the data
and get on with any further pre-processing I may need to do. Since
the data isn't meant to be 'machinable' it's probably going to take
quite a bit more work once I rearrange the columns.

> If I was coding a macro I would proceed:-
> Select 1st a page, copy to text register 21
> Select 1st b page, copy to text register 22
> Switch buffers, append text register 21, append text register 22.
> Clear registers.
> Return to original buffer & repeat.

> One other option is to copy all pages of a's to a buffer, then all
> b's to another and merge them page by page

Thanks for the suggestions, Ian. I've been dragging my feet on this
one for a few days since it's such a long amount of technical data.
No matter how I attack this it seems I am not going to be able to
escape many hours of proofing. Some of the data was using attributes
to denote certain things (EG: bold, underline, etc) that the
conversion to ASCII lost.

--
John

 


Topic: Re: Dual columns and column block insertion (4 of 13), Read 39 times
Conf: Basic editing, Block operations
From: Christian Ziemski
Date: Monday, February 07, 2005 12:22 PM

John:

On Mon, 07 Feb 2005 02:09:00 -0500, you wrote:

>Correct. I'm sure you follow what I am/was trying to do,
>but in sake of clarity I am wanting to change:
>
>aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
>aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
>aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
>aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
>[FF]
>aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
>etc..
>
>..to:
>
>aaaaaaaaaaaaaaa
>aaaaaaaaaaaaaaa
>aaaaaaaaaaaaaaa
>aaaaaaaaaaaaaaa
>
>bbbbbbbbbbbbbbb
>bbbbbbbbbbbbbbb
>bbbbbbbbbbbbbbb
>bbbbbbbbbbbbbbb
>[FF]
>aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
>etc..

I would try it half-manually:

1.) Highlight the columns [2] with those b's as a columnar block
2.) Position the cursor at the place where you want to have moved it
3.) Hit a key with a little macro assigned to it:
- copy the highlighted block to a temorary buffer
- delete the block from the file
- count the lines of text in the temporary buffer
- insert as many linefeeds as counted above
- goto the beginning of these inserted linefeeds
- insert the text from the temporary buffer
- delete temporary buffer
4.) Repeat as often as necessary


Perhaps there is an easier way using different block modes while
inserting. No time to test yet...

BTW: You should avoid using "tags" like the < ff > in your
original message. WebBoard often renders them invisible...


Christian

 


Topic: Dual columns and column block insertion (5 of 13), Read 41 times
Conf: Basic editing, Block operations
From: John H
Date: Monday, February 07, 2005 02:42 PM

On Mon, 7 Feb 2005 12:23:24 -0500 GMT, Christian Ziemski wrote:

Hi Christian,

> I would try it half-manually:

> 1.) Highlight the columns [2] with those b's as a columnar block
> 2.) Position the cursor at the place where you want to have moved it
> 3.) Hit a key with a little macro assigned to it:
> - copy the highlighted block to a temorary buffer
> - delete the block from the file
> - count the lines of text in the temporary buffer
> - insert as many linefeeds as counted above
> - goto the beginning of these inserted linefeeds
> - insert the text from the temporary buffer
> - delete temporary buffer
> 4.) Repeat as often as necessary

Sounds like a good approach.

> Perhaps there is an easier way using different block modes while
> inserting. No time to test yet...

Any findings you come up with will be welcome, however please don't
pursue this solely for my benefit. Some OCR related page reflow
macros might be kind of a neat macro set for vedit though. :-)

It might also be that with further investigation of the OCR software
I could go back and re-do the document and save some time. My first
thoughts were 'keep the OCR simple and get things into shape with
vedit' -- thus I really didn't dig too far into the OCR
possibilities of reflowing the basic structure of the output file.

After browsing the file earlier this morning I am re-evaluating my
approach to this also. The 'a' and 'b' columns are comprised of
about 7-8 columns each, usually (!) which are going to need
attention also. Some can be dropped, some will need new values and
some are just plain skewed and need moving into the proper sub-
column(s) or delimited.

> BTW: You should avoid using "tags" like the < ff > in your
> original message. WebBoard often renders them invisible...

Ah, okay. I hardly ever use webboards directly and forget about
their features.

--
John

 


Topic: Re: Dual columns and column block insertion (6 of 13), Read 44 times
Conf: Basic editing, Block operations
From: Christian Ziemski
Date: Monday, February 07, 2005 04:55 PM

John:

On Mon, 07 Feb 2005 14:42:00 -0500, you wrote:

>On Mon, 7 Feb 2005 12:23:24 -0500 GMT, Christian Ziemski wrote:
>
>> I would try it half-manually:
>
>> 1.) .
>> 2.) ..
>> 3.) ...
>
>Sounds like a good approach.
>
>> Perhaps there is an easier way using different block modes while
>> inserting. No time to test yet...

Now I spent some minutes before end-of-day...


Here my quick solution as starting point:


Before:

aaaaaaaaaaaaaaa Bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbB

CCCCCCCCCCCCCCC DDDDDDDDDDDDDDD
CCCCCCCCCCCCCCC DDDDDDDDDDDDDDD
CCCCCCCCCCCCCCC DDDDDDDDDDDDDDD

After:

aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa

Bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbB

CCCCCCCCCCCCCCC DDDDDDDDDDDDDDD
CCCCCCCCCCCCCCC DDDDDDDDDDDDDDD
CCCCCCCCCCCCCCC DDDDDDDDDDDDDDD



// First solution with automatic positioning
//
// Assign the macro below to a key.
// Then highlight the b's as columnar block.
// Then press that key.
// ==> The highlighted block will be moved right below the a's.

if ((Block_Begin!=-1) && (Block_End!=-1) && (Block_Mode==COLUMN)) {
#103=Min(Block_Begin, Block_End)
#104=Max(Block_Begin, Block_End)
#104++
Set_Marker(9, #104)
Reg_Copy_Block(103, #103, #104, COLUMN+DELETE)
Block_Begin(CLEAR)
Goto_Pos(Marker(9))
Line(1, NOERR)
Ins_Newline(1)
Reg_Ins(103, RAW) // insert block as STREAM
}



// Second solution with inserting at user's cursor position
//
// Assign the macro below to a key.
// Then highlight the b's as columnar block.
// Then position the cursor to the place where the block should be
// moved to.
// Then press that key.

if ((Block_Begin!=-1) && (Block_End!=-1) && (Block_Mode==COLUMN)) {
Set_Marker(9, Cur_Pos)
#103=Min(Block_Begin, Block_End)
#104=Max(Block_Begin, Block_End)
#104++
Reg_Copy_Block(103, #103, #104, COLUMN+DELETE)
Block_Begin(CLEAR)
Goto_Pos(Marker(9))
Ins_Newline(1) // optionally
Reg_Ins(103, RAW) // insert block as STREAM
}


Christian

 


Topic: Dual columns and column block insertion (7 of 13), Read 47 times
Conf: Basic editing, Block operations
From: John H
Date: Tuesday, February 08, 2005 01:55 AM

On Mon, 7 Feb 2005 16:32:38 -0500 GMT, Christian Ziemski wrote:

> Now I spend some minutes before end-of-day...

Nice Christian, since I last wrote have spit the file into pages
and have begun the task of alignment of the sub column data and
basic proofing.

The stock column block cut & paste works okay in this situation
since there is only one set of A & B column groups, hence no
overwritten next page data.

If these pages were a bit more predictable and I could count on a
consistent row for a A/B group separator it would help automate
moving the columns..

I think that my best bet for the time being is to just plug away and
get this phase completed. At least I can count pages as I go and see
the forward progress. It's taking about 2 minutes per page to move
the column down and then make a quick pass of the data to verify the
OCR accuracy.

I'll be much happier when I get beyond this and can begin on the
front end for the database. :-)

--
John

 


Topic: Dual columns and column block insertion (8 of 13), Read 47 times
Conf: Basic editing, Block operations
From: Ian Binnie
Date: Tuesday, February 08, 2005 07:59 PM

On 2/8/2005 1:55:52 AM, John H wrote:
>On Mon, 7 Feb 2005 16:32:38 -0500 GMT,
>The stock column block cut & paste works
>okay in this situation
>since there is only one set of A & B
>column groups, hence no
>overwritten next page data.

One further thought occurred to me.
Vedit distinguishes between lines & column blocks in the scratchpad.

One other approach is to select the b's columnar block, cut to scratchpad.

Create (or change to) new buffer, insert scratchpad.
Select the newly pasted text, then cut as lines to scratchpad.

Return to original buffer, then paste the lines.

 


Topic: Dual columns and column block insertion (9 of 13), Read 47 times
Conf: Basic editing, Block operations
From: John H
Date: Tuesday, February 08, 2005 10:29 PM

On Tue, 8 Feb 2005 20:00:00 -0500 GMT, Ian Binnie wrote:

> One further thought occurred to me.
> Vedit distinguishes between lines & column blocks in the scratchpad.

> One other approach is to select the b's columnar block, cut to scratchpad.

> Create (or change to) new buffer, insert scratchpad.
> Select the newly pasted text, then cut as lines to scratchpad.

> Return to original buffer, then paste the lines.

Since you brought that up, it hadn't occurred to me that I might
simply have been able to paste this stuff a regular block, which
seems to work just fine -- pushing the next page of data down.

Ah well, something to keep a mental note about. Funny how I simply
assumed that I needed to use 'paste columnar block' since I selected
the block with ALT-I..

--
John

 


Topic: Dual columns and column block insertion (10 of 13), Read 45 times
Conf: Basic editing, Block operations
From: Christian Ziemski
Date: Wednesday, February 09, 2005 03:00 AM

On 2/8/2005 7:59:18 PM, Ian Binnie wrote:

>One further thought occurred to me.
>Vedit distinguishes between lines & column blocks in the scratchpad.
>
>One other approach is to select the b's columnar block, cut to scratchpad.
>
>Create (or change to) new buffer, insert scratchpad.
>Select the newly pasted text, then cut as lines to scratchpad.
>
>Return to original buffer, then paste the lines.


That is what the simple macros in my last message do:

# have the user highlight the text as columnar block
#
# then copy/delete it to text register
Reg_Copy_Block(103, #103, #104, COLUMN+DELETE)
....
# goto new position and insert it again
Reg_Ins(103, RAW) // insert block as STREAM


Christian

 


Topic: Dual columns and column block insertion (11 of 13), Read 45 times
Conf: Basic editing, Block operations
From: Ian Binnie
Date: Wednesday, February 09, 2005 03:36 AM

On 2/9/2005 3:00:48 AM, Christian Ziemski wrote:

># goto new position and insert it again
>Reg_Ins(103, RAW) // insert block as
>STREAM

Christian,

I had not realised this was possible.
There does not seem to be a visual equivalent.

 


Topic: Dual columns and column block insertion (12 of 13), Read 45 times
Conf: Basic editing, Block operations
From: Christian Ziemski
Date: Wednesday, February 09, 2005 05:24 AM

On 2/9/2005 3:36:27 AM, Ian Binnie wrote:
>On 2/9/2005 3:00:48 AM, Christian Ziemski wrote:
>
>># goto new position and insert it again
>>Reg_Ins(103, RAW) // insert block as STREAM
>
>I had not realised this was possible.
>There does not seem to be a visual equivalent.

Ian:

I'm not sure that I'm understanding you correctly.

The visual {Block, Insert Register} or NumPad* has the options
( ) Auto
( ) Stream
( ) Column
( ) Line

That corresponds to the macro commands

Reg_Ins(r)
Reg_Ins(r, RAW)
Reg_Ins(r, COLUMN)
Reg_Ins(r, LINEBLOCK)


Christian

 


Topic: Dual columns and column block insertion (13 of 13), Read 47 times
Conf: Basic editing, Block operations
From: Ian Binnie
Date: Wednesday, February 09, 2005 07:34 PM

On 2/9/2005 5:24:26 AM, Christian Ziemski wrote:
>On 2/9/2005 3:36:27 AM, Ian Binnie
>wrote:
>>On 2/9/2005 3:00:48 AM, Christian Ziemski wrote:
>>
>>># goto new position and insert it again
>>>Reg_Ins(103, RAW) // insert block as STREAM
>>
>>I had not realised this was possible.
>>There does not seem to be a visual equivalent.
>
>Ian:
>
>I'm not sure that I'm understanding you
>correctly.
>
>The visual {Block, Insert Register} or
>NumPad* has the options
> ( ) Auto
> ( ) Stream
> ( ) Column
> ( ) Line
>

Christian,

You are correct. I was looking at the Edit Menu, which has the Clipboard & Scratchpad items.

In fact I have been using Vedit for so long (pre 3.60) that I have memorised the keys and rarely use the menus (although the toolbar is handy). The downside is that I may miss new features.

I have to admit that pressing F11 does bring up the menu with those options, but I am so used to just typing the register number I haven't looked at it.

I had not realised that pasting a column block as a stream was possible, but it is in 5.16, so I have been wasting a lot of effort for some time.