I really appreciate the feedback, Corion. Thank you.

Actually, the US Postal Service has a list of standard abbreviations for use with postal addressing, at least in the US. What I did was to create a set of regexes for those, so as they set now they just consist of the regexes and the common abbreviations they refer to, in a form I could generate the tests from. I haven't put them into a more usable form yet, due in part to a lack of to-its.

(Right now, it is a set of hashes with the key being the abbreviation, with one subkey being the regex, another being the common abbreviations it was to later test (including some not listed but that seemed plausible as well). An example would be the following snippet:
my %state_or_province_designator = ( AL => { regex => qr/AL(?:A(?:\.|BAMA)?)?\.?/i, test_case => [qw( ALA ALA. ALABAMA )], }, AK => { regex => qr/A(?:K|LAS(?:KA?)?)\.?/i, test_case => [qw( ALASKA )], }, AS => { regex => qr/A(?:\.?|M(?:\.|ER(?:\.|ICAN)?)?)\s*S(?:AM(?:\.|OA) +?)?|A\.\s*S\./i, test_case => [], }, ... ); # AS test case generation push @{ $state_or_province_designator{AS}{test_case} }, generate_from_array_2( [ [qw( A A. AM AM. AMER AMER. AMERICAN )], [qw( S S. SAM SAM. SAMOA )] ] );
where the standard abbreviation would also be used in the tests when generated later.)

I'll take a look at the FOAF project link you indicated, to see if there seems to be anything there that might be of use, as well as look over your recommendations when I have neurons firing a little more in tune.


In reply to Re^2: Suggestions requested: module to standardize postal address components? by atcroft
in thread Suggestions requested: module to standardize postal address components? by atcroft

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.