README
1NAME
2
3Lingua::EN::AddressParse - extract components of a street address from free format text
4
5SYNOPSIS
6
7 use Lingua::EN::AddressParse;
8
9 my %args =
10 (
11 country => 'US',
12 auto_clean => 1,
13 force_case => 1,
14 abbreviate_subcountry => 0,
15 abbreviated_subcountry_only => 0,
16 force_post_code => 0
17 );
18
19 my $address = Lingua::EN::AddressParse->new(%args);
20 $error = $address->parse("40 1/2 N OLD MASSACHUSETTS AVE APT 3B Washington Valley Washington 98100: HOLD MAIL");
21
22 print $address->report;
23
24 Country address format 'US'
25 Address type 'suburban'
26 Non matching part 'HOLD MAIL '
27 Error '1'
28 Error descriptions 'non matching section : HOLD MAIL '
29 Warning '1'
30 Warning description ''
31 Case all '40 1/2 N Old Massachusetts Ave Apt 3B Washington Valley WA 98100'
32 COMPONENTS ''
33 base_street_name 'Old Massachusetts'
34 post_code '98100'
35 property_identifier '40 1/2'
36 street_direction_prefix 'N'
37 street_name 'N Old Massachusetts'
38 street_type 'Ave'
39 sub_property_identifier '3B'
40 sub_property_type 'Apt'
41 subcountry 'WA'
42 suburb 'Washington Valley'
43
44 %address_components = $address->components;
45 print $address_components{sub_property_type}; # APT
46 print $address_components{sub_property_identifier}; # 3B
47 print $address_components{property_identifier}; # 40 1/2
48
49 %address_properties = $address->properties;
50 print $address_properties{type}; # suburban
51 print $address_properties{non_matching}; # : HOLD MAIL
52
53 $correct_casing = $address->case_all;
54
55
56=head1 DESCRIPTION
57
58This module takes as input a suburban, rural or postal address in free format
59text such as,
60
61 3080 28TH AVE N ST PETERSBURG, FL 33713-3810
62 12 1st Avenue N Suite # 2 Somewhere CA 12345 USA
63 C/O JOHN, KENNETH JR POA 744 WIND RIVER DR SYLVANIA, OH 43560-4317
64
65 9 Church Street, Abertillery, Mid Glamorgan NP13 1DA
66 27 Bury Street, Abingdon, Oxfordshire OX14 3QT
67
68 2A LOW ST KEW NSW 2123
69 12/3-5 AUBREY ST MOUNT VICTORIA VICTORIA 3133
70 "OLD REGRET" WENTWORTH FALLS NSW 2782 AUSTRALIA
71 GPO Box K318, HAYMARKET, NSW 2000
72
73
74and attempts to parse it. If successful, the address is broken
75down into it's components and useful functions can be performed such as :
76
77 converting upper or lower case values to title case (2A Low St Kew NSW 2123)
78 extracting the addresses individual components (2A,Low,St,KEW,NSW,2123)
79 determining the type of format the address is in ('suburban')
80
81
82If the address cannot be parsed you have the option of cleaning the address
83of bad characters, or extracting any portion that was parsed and the portion
84that failed.
85
86This module can be used for analysing and improving the quality of
87lists of residential and postal addresses.
88
89
90HOW TO INSTALL
91
92 perl Makefile.PL
93 make
94 make test
95 make install
96
97 or
98
99 perl Build.PL
100 build
101 build test
102 build install
103
104AUTHOR
105
106AddressParse was written by Kim Ryan <<kimryan at cpan d o t org>
107
108COPYRIGHT AND LICENSE
109
110Copyright (c) 2016 Kim Ryan. All rights reserved.
111
112This program is free software; you can redistribute it
113and/or modify it under the terms of the Perl Artistic License
114(see http://www.perl.com/perl/misc/Artistic.html).
115
116
117
118
119