Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (8)
As of 2024-04-23 17:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found