#!/usr/bin/perl -w # # Parse text from BrowserUk's home node. use strict; use warnings; { my ( %directionAbbreviation3, %directionAbbreviation2, %directionAbbreviation1 ); for my $dir1 (qw/north south east west/) { DIR2: for my $dir2 (qw/north south east west/) { next DIR2 if ( $dir1 eq $dir2 ); next DIR2 if ( $dir1 eq 'north' && $dir2 eq 'south' ); next DIR2 if ( $dir2 eq 'north' && $dir1 eq 'south' ); next DIR2 if ( $dir1 eq 'west' && $dir2 eq 'east' ); next DIR2 if ( $dir2 eq 'west' && $dir1 eq 'east' ); my $dir = "$dir1-$dir2-$dir1"; my $abbreviation = uc( substr( $dir1, 0, 1 ) . substr( $dir2, 0, 1 ) . substr( $dir1, 0, 1 ) ); $directionAbbreviation3{$dir} = $abbreviation; $directionAbbreviation3{ $dir . "erly" } = $abbreviation . "erly"; $dir = "$dir1-$dir2"; $abbreviation = uc( substr( $dir1, 0, 1 ) . substr( $dir2, 0, 1 ) ); $directionAbbreviation2{$dir} = $abbreviation; $directionAbbreviation2{ $dir . "erly" } = $abbreviation . "erly"; } $directionAbbreviation1{"$dir1"} = uc( substr( $dir1, 0, 1 ) ); $directionAbbreviation1{"${dir1}erly"} = uc( substr( $dir1, 0, 1 ) ) . "erly"; } while () { # Do double line breaks before 'from a point' and 'to a point'; s/((from|to) a point)/\n\n$1/g; # single line breaks after 'and', 'proceeding' and 'on the'; s/(and)\s/$1\n/g; s/(proceeding)/\n$1/g; s/(on the)\s/$1\n/g; # double line break before the 'be, since that separates the first # clause from the second; s/\s(be\s)/\n\n$1/g; # do some basic abbreviations; s/Unit (\d) Foundry Industrial Estate, Victoria Street/Unit $1/g; s/ metres?/m/g; # Shorten the compass directions that were set up previously; foreach my $direction ( keys %directionAbbreviation3 ) { s/$direction\s/$directionAbbreviation3{$direction}." "/ge; } foreach my $direction ( keys %directionAbbreviation2 ) { s/$direction\s/$directionAbbreviation2{$direction}." "/ge; } foreach my $direction ( keys %directionAbbreviation1 ) { s/$direction\s/$directionAbbreviation1{$direction}." "/ge; } # Replace the shortened compass directions 'N W' with 'NW', and # eliminate any leading spaces on lines that aren't empty (thus # preserving blank lines). s/([NEWS])\s([NEWS])/$1$2/g; s/^\s+(\w)/$1/g; print; } } __DATA__ A path from a point approximately 330 metres east of the most south-westerly corner of 17 Batherton Close, Widnes and approximately 208 metres east-south-east of the most southerly corner of Unit 3 Foundry Industrial Estate, Victoria Street, Widnes, proceeding in a generally east-north-easterly direction for approximately 28 metres to a point approximately 202 metres east-south-east of the most south-easterly corner of Unit 4 Foundry Industrial Estate, Victoria Street, and approximately 347 metres east of the most south-easterly corner of 17 Batherton Close, then proceeding in a generally northerly direction for approximately 21 metres to a point approximately 210 metres east of the most south-easterly corner of Unit 5 Foundry Industrial Estate, Victoria Street, and approximately 202 metres east-south-east of the most north-easterly corner of Unit 4 Foundry Industrial Estate, Victoria Street, then proceeding in a generally east-north-east direction for approximately 64 metres to a point approximately 282 metres east-south-east of the most easterly corner of Unit 2 Foundry Industrial Estate, Victoria Street, Widnes and approximately 259 metres east of the most southerly corner of Unit 4 Foundry Industrial Estate, Victoria Street, then proceeding in a generally east-north-east direction for approximately 350 metres to a point approximately 3 metres west-north-west of the most north westerly corner of the boundary fence of the scrap metal yard on the south side of Cornubia Road, Widnes, and approximately 47 metres west-south-west of the stub end of Cornubia Road be diverted to a 3 metre wide path from a point approximately 183 metres east-south-east of the most easterly corner of Unit 5 Foundry Industrial Estate, Victoria Street and approximately 272 metres east of the most north-easterly corner of 26 Ann Street West, Widnes, then proceeding in a generally north easterly direction for approximately 58 metres to a point approximately 216 metres east-south-east of the most easterly corner of Unit 4 Foundry Industrial Estate, Victoria Street and approximately 221 metres east of the most southerly corner of Unit 5 Foundry Industrial Estate, Victoria Street, then proceeding in a generally easterly direction for approximately 45 metres to a point approximately 265 metres east-south-east of the most north-easterly corner of Unit 3 Foundry Industrial Estate, Victoria Street and approximately 265 metres east of the most southerly corner of Unit 5 Foundry Industrial Estate, Victoria Street, then proceeding in a generally east-south-east direction for approximately 102 metres to a point approximately 366 metres east-south-east of the most easterly corner of Unit 3 Foundry Industrial Estate, Victoria Street and approximately 463 metres east of the most north easterly corner of 22 Ann Street West, Widnes, then proceeding in a generally north-north-easterly direction for approximately 19 metres to a point approximately 368 metres east-south-east of the most easterly corner of Unit 3 Foundry Industrial Estate, Victoria Street and approximately 512 metres east of the most south easterly corner of 17 Batherton Close, Widnes then proceeding in a generally east-south, easterly direction for approximately 16 metres to a point approximately 420 metres east-south-east of the most southerly corner of Unit 2 Foundry Industrial Estate, Victoria Street and approximately 533 metres east of the most south-easterly corner of 17 Batherton Close, then proceeding in a generally east-north-easterly direction for approximately 240 metres to a point approximately 606 metres east of the most northerly corner of Unit 4 Foundry Industrial Estate, Victoria Street and approximately 23 metres south of the most south westerly corner of the boundary fencing of the scrap metal yard on the south side of Cornubia Road, Widnes, then proceeding in a generally northern direction for approximately 44 metres to a point approximately 3 metres west-north-west of the most north westerly corner of the boundary fence of the scrap metal yard on the south side of Cornubia Road and approximately 47 metres west-south-west of the stub end of Cornubia Road.