The text on BrowserUk's home node ("A path from a point approximately 330 metres east ..") has always struck me as a fascinating challenge. So today I built a little script to decompose this language.
#!/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 (<DATA>) { # 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 firs +t # 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-we +sterly corner of 17 Batherton Close, Widnes and approximately 208 met +res east-south-east of the most southerly corner of Unit 3 Foundry In +dustrial Estate, Victoria Street, Widnes, proceeding in a generally e +ast-north-easterly direction for approximately 28 metres to a point a +pproximately 202 metres east-south-east of the most south-easterly co +rner of Unit 4 Foundry Industrial Estate, Victoria Street, and approx +imately 347 metres east of the most south-easterly corner of 17 Bathe +rton Close, then proceeding in a generally northerly direction for ap +proximately 21 metres to a point approximately 210 metres east of the + most south-easterly corner of Unit 5 Foundry Industrial Estate, Vict +oria 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-sout +h-east of the most easterly corner of Unit 2 Foundry Industrial Estat +e, Victoria Street, Widnes and approximately 259 metres east of the m +ost southerly corner of Unit 4 Foundry Industrial Estate, Victoria St +reet, then proceeding in a generally east-north-east direction for ap +proximately 350 metres to a point approximately 3 metres west-north-w +est of the most north westerly corner of the boundary fence of the sc +rap metal yard on the south side of Cornubia Road, Widnes, and approx +imately 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 metre +s east-south-east of the most easterly corner of Unit 5 Foundry Indus +trial Estate, Victoria Street and approximately 272 metres east of th +e most north-easterly corner of 26 Ann Street West, Widnes, then proc +eeding in a generally north easterly direction for approximately 58 m +etres 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 Un +it 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 c +orner of Unit 3 Foundry Industrial Estate, Victoria Street and approx +imately 265 metres east of the most southerly corner of Unit 5 Foundr +y Industrial Estate, Victoria Street, then proceeding in a generally +east-south-east direction for approximately 102 metres to a point app +roximately 366 metres east-south-east of the most easterly corner of +Unit 3 Foundry Industrial Estate, Victoria Street and approximately 4 +63 metres east of the most north easterly corner of 22 Ann Street Wes +t, Widnes, then proceeding in a generally north-north-easterly direct +ion for approximately 19 metres to a point approximately 368 metres e +ast-south-east of the most easterly corner of Unit 3 Foundry Industri +al Estate, Victoria Street and approximately 512 metres east of the m +ost south easterly corner of 17 Batherton Close, Widnes then proceedi +ng in a generally east-south, easterly direction for approximately 16 + metres to a point approximately 420 metres east-south-east of the mo +st southerly corner of Unit 2 Foundry Industrial Estate, Victoria Str +eet and approximately 533 metres east of the most south-easterly corn +er of 17 Batherton Close, then proceeding in a generally east-north-e +asterly direction for approximately 240 metres to a point approximate +ly 606 metres east of the most northerly corner of Unit 4 Foundry Ind +ustrial Estate, Victoria Street and approximately 23 metres south of +the most south westerly corner of the boundary fencing of the scrap m +etal yard on the south side of Cornubia Road, Widnes, then proceeding + in a generally northern direction for approximately 44 metres to a p +oint approximately 3 metres west-north-west of the most north westerl +y corner of the boundary fence of the scrap metal yard on the south s +ide of Cornubia Road and approximately 47 metres west-south-west of t +he stub end of Cornubia Road.
When run, this outputs the following, slightly more readable text:
A path from a point approximately 330m E of the most SWerly corner of 17 Bath +erton Close, Widnes and approximately 208m ESE of the most Serly corner of Unit 3, Widnes, proceeding in a generally ENEerly direction for approximately 28m to a point approximately 202m ESE of the most SEerly corner of Unit 4, + and approximately 347m E of the most SEerly corner of 17 Batherton Close, +then proceeding in a generally Nerly direction for approximately 21m to a point approximately 210m E of the most SEerly corner of Unit 5, a +nd approximately 202m ESE of the most NEerly corner of Unit 4, then proceeding in a generally ENE direction for approximately 64m to a point approximately 282m ESE of the most Eerly corner of Unit 2, +Widnes and approximately 259m E of the most Serly corner of Unit 4, then proceeding in a generally ENE direction for approximately 350m to a point approximately 3m WNW of the most NWerly corner of the bound +ary fence of the scrap metal yard on the S side of Cornubia Road, Widnes, and approximately 47m WSW of the stub end of Cornubia Road be diverted to a 3m wide path from a point approximately 183m ESE of the most Eerly corner of Unit 5 + and approximately 272m E of the most NEerly corner of 26 Ann Street West, +Widnes, then proceeding in a generally NEerly direction for approximately 58m to a point approximately 216m ESE of the most Eerly corner of Unit 4 a +nd approximately 221m E of the most Serly corner of Unit 5, then proceeding in a generally Eerly direction for approximately 45m to a point approximately 265m ESE of the most NEerly corner of Unit 3 +and approximately 265m E of the most Serly corner of Unit 5, then proceeding in a generally ESE direction for approximately 102m to a point approximately 366m ESE of the most Eerly corner of Unit 3 a +nd approximately 463m E of the most NEerly corner of 22 Ann Street West, +Widnes, then proceeding in a generally north-NEerly direction for approximately 19m + to a point approximately 368m ESE of the most Eerly corner of Unit 3 a +nd approximately 512m E of the most SEerly corner of 17 Batherton Close, +Widnes then proceeding in a generally east-south, Eerly direction for approximatel +y 16m to a point approximately 420m ESE of the most Serly corner of Unit 2 a +nd approximately 533m E of the most SEerly corner of 17 Batherton Close, +then proceeding in a generally ENEerly direction for approximately 240m to a point approximately 606m E of the most Nerly corner of Unit 4 and approximately 23m S of the most SWerly corner of the boundary fencing +of the scrap metal yard on the S side of Cornubia Road, Widnes, then proceeding in a generally northern direction for approximately 44m to a point approximately 3m WNW of the most NWerly corner of the bound +ary fence of the scrap metal yard on the S side of Cornubia Road and approximately 47m WSW of the stub end of Cornubia Road.
Not perfect, but an amusing diversion.
Alex / talexb / Toronto
Team website: Forex Chart Monkey, Forex Technical Analysis and Pickpocket Prevention
"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds
In reply to Disentangling the English language by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |