From: Regina Obe Date: Sat, 25 Oct 2014 07:28:00 +0000 (+0000) Subject: work in progress - will reshuffle some things later X-Git-Tag: 2.2.0rc1~745 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=819c90aedbfdba1ad2165f722070723084fc7b1a;p=postgis work in progress - will reshuffle some things later git-svn-id: http://svn.osgeo.org/postgis/trunk@13111 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/extras_address_standardizer.xml b/doc/extras_address_standardizer.xml index f8995e8f8..07b022791 100644 --- a/doc/extras_address_standardizer.xml +++ b/doc/extras_address_standardizer.xml @@ -32,110 +32,110 @@ into includes in the future for easier maintenance. - - - This section lists the PostgreSQL data types installed by Address Standardizer extension. Note we describe the casting behavior of these which is very - important especially when designing your own functions. - - - - Address Standardizer Types - - - stdaddr - A composite type that consists of the elements of an address. This is the return type for standardize_address function. - - - Description - A composite type that consists of elements of an address. This is the return type for function. Some descriptions for elements are borrowed from PAGC Postal Attributes. - The token numbers denote the reference number in the rules table. - &address_standardizer_required; - - - building - - is text (token number 0): Refers to building number or name. Unparsed building identifiers and types. Generally blank for most addresses. - - - house_num - - is a text (token number 1): This is the street number on a street. Example 75 in 75 State Street. - - - predir - is text (token number 2): STREET NAME PRE-DIRECTIONAL such as North, South, East, West etc. - - qual - - is text (token number 3): STREET NAME PRE-MODIFIER Example OLD in 3715 OLD HIGHWAY 99. - - - pretype - - is text (token number 4): STREET PREFIX TYPE - - - name - - is text (token number 5): STREET NAME - - - suftype - - is text (token number 6): STREET POST TYPE e.g. St, Ave, Cir. A street type following the root street name. Example STREET in 75 State Street. - - - sufdir - - is text (token number 7): STREET POST-DIRECTIONAL A directional modifier that follows the street name.. Example WEST in 3715 TENTH AVENUE WEST. - - - ruralroute - - is text (token number 8): RURAL ROUTE . Example 8 in RR 7. - - - extra - - is text: Extra information like Floor number. - - - city - - is text (token number 10): Example Boston. - - - state - - is text (token number 11): Example MASSACHUSETTS - - - country - - is text (token number 12): Example USA - - - postcode - - is text POSTAL CODE (ZIP CODE) (token number 13): Example 02109 - - - box - - is text POSTAL BOX NUMBER (token number 14 and 15): Example 02109 - - - unit - - is text Apartment number or Suite Number (token number 17): Example 3B in APT 3B. - - - - - + + + This section lists the PostgreSQL data types installed by Address Standardizer extension. Note we describe the casting behavior of these which is very + important especially when designing your own functions. + + + + Address Standardizer Types + + + stdaddr + A composite type that consists of the elements of an address. This is the return type for standardize_address function. + + + Description + A composite type that consists of elements of an address. This is the return type for function. Some descriptions for elements are borrowed from PAGC Postal Attributes. + The token numbers denote the output reference number in the . + &address_standardizer_required; + + + building + + is text (token number 0): Refers to building number or name. Unparsed building identifiers and types. Generally blank for most addresses. + + + house_num + + is a text (token number 1): This is the street number on a street. Example 75 in 75 State Street. + + + predir + is text (token number 2): STREET NAME PRE-DIRECTIONAL such as North, South, East, West etc. + + qual + + is text (token number 3): STREET NAME PRE-MODIFIER Example OLD in 3715 OLD HIGHWAY 99. + + + pretype + + is text (token number 4): STREET PREFIX TYPE + + + name + + is text (token number 5): STREET NAME + + + suftype + + is text (token number 6): STREET POST TYPE e.g. St, Ave, Cir. A street type following the root street name. Example STREET in 75 State Street. + + + sufdir + + is text (token number 7): STREET POST-DIRECTIONAL A directional modifier that follows the street name.. Example WEST in 3715 TENTH AVENUE WEST. + + + ruralroute + + is text (token number 8): RURAL ROUTE . Example 8 in RR 7. + + + extra + + is text: Extra information like Floor number. + + + city + + is text (token number 10): Example Boston. + + + state + + is text (token number 11): Example MASSACHUSETTS + + + country + + is text (token number 12): Example USA + + + postcode + + is text POSTAL CODE (ZIP CODE) (token number 13): Example 02109 + + + box + + is text POSTAL BOX NUMBER (token number 14 and 15): Example 02109 + + + unit + + is text Apartment number or Suite Number (token number 17): Example 3B in APT 3B. + + + + + - + This section lists the PostgreSQL table formats used by the address_standardizer for normalizing addresses. Note that these tables do not need to be named the same as what is referenced here. You can have different lex, gaz, rules tables for each country for example or for your custom geocoder. The names of these tables get passed into the address standardizer functions. @@ -144,152 +144,228 @@ into includes in the future for easier maintenance. Address Standardizer Tables - - rules table - The rules table contains a set of rules that maps address input sequence tokens to standardized output sequence - - - Description - A rules table must have at least the following columns, though you are allowed to add more for your own uses. + + rules table + The rules table contains a set of rules that maps address input sequence tokens to standardized output sequence + + + Description + A rules table must have at least the following columns, though you are allowed to add more for your own uses. + + + + id + + Primary key of table + + + rule + + text field denoting the rule. Details at PAGC Address Standardizer Rule records. + A rule consists of a set of non-negative integers representing input tokens, terminated by a -1, followed by an equal number of non-negative integers representing postal attributes, terminated by a -1, followed by an integer representing a rule type, followed by an integer representing the rank of the rule. The rules are ranked from 0 (lowest) to 17 (highest). + So for example the rule 2 0 2 22 3 -1 5 5 6 7 3 -1 2 6 maps to sequence of output tokens TYPE NUMBER TYPE DIRECT QUALIF to the output sequence STREET STREET SUFTYP SUFDIR QUALIF. The rule is an ARC_C rule of rank 6. + Numbers for corresponding output tokens are listed in . + + + + + + Input Tokens + Each rule starts with a set of input tokens followed by a terminator -1. Valid input tokens excerpted from PAGC Input Tokens are as follows: + Form-Based Input Tokens + + + AMPERS + + (13). The ampersand (&) is frequently used to abbreviate the word "and". + + - - - id - - Primary key of table - - - rule - - text field denoting the rule. Details at PAGC Address Standardizer Rule records. - A rule consists of a set of non-negative integers representing input tokens, terminated by a -1, followed by an equal number of non-negative integers representing postal attributes, terminated by a -1, followed by an integer representing a rule type, followed by an integer representing the rank of the rule. The rules are ranked from 0 (lowest) to 17 (highest). - So for example the rule 2 0 2 22 3 -1 5 5 6 7 3 -1 2 6 maps to sequence of tokens TYPE NUMBER TYPE DIRECT QUALIF to the output sequence STREET STREET SUFTYP SUFDIR QUALIF. The rule is an ARC_C rule of rank 6. - - - + + DASH + + (9). A punctuation character. + + - Each rule has a rule type which is denoted by one of following: - - - MACRO_C - - (token number = "0"). The class of rules for parsing MACRO clauses. - - - - MICRO_C - - (token number = "1"). The class of rules for parsing full MICRO clauses (ie ARC_C plus CIVIC_C). These rules are not used in the build phase. - - - - ARC_C - - (token number = "2"). The class of rules for parsing MICRO clauses, excluding the HOUSE attribute. - - - - CIVIC_C - - (token number = "3"). The class of rules for parsing the HOUSE attribute. - - - - EXTRA_C - - (token number = "4"). The class of rules for parsing EXTRA attributes - attributes excluded from geocoding. These rules are not used in the build phase. - - - + + DOUBLE + + (21). A sequence of two letters. Often used as identifiers. + + - - - - - - lex table - A lex table is used to classify alphanumeric input and associate that input with (a) input tokens ( See Input Tokens) and (b) standardized representations. - - - Description - A lex (short for lexicon) table is used to classify alphanumeric input and associate that input with (a) input tokens and (b) standardized representations. Things you will find in these tables are ONE mapped to stdworkd: 1. + + FRACT + + (25). Fractions are sometimes used in civic numbers or unit numbers. + + - A lex has at least the following columns in the table. You may add - - - id - - Primary key of table - - - seq - - integer: definition number? - - - - word - - text: the input word - - - stdword - - text: the standardized replacement word - - - token - - integer: the kind of word it is. Only if it is used in this context will it be replaced. Refer to PAGC Tokens. - - - - - - - - - gaz table - A gaz table is used to standardize place names and associate that input with (a) input tokens ( See Input Tokens) and (b) standardized representations. - - - Description - A gaz (short for gazeteer) table is used to classify place names and associate that input with (a) input tokens and (b) standardized representations. For example if you are in US, you may load these with State Names and associated abbreviations. + + MIXED + + (23). An alphanumeric string that contains both letters and digits. Used for identifiers. + + - A gaz table has at least the following columns in the table. You may add more columns if you wish for your own purposes. - - - id - - Primary key of table - - - seq - - integer: definition number? - - - word - - text: the input word - - - stdword - - text: the standardized replacement word - - - token - - integer: the kind of word it is. Only if it is used in this context will it be replaced. Refer to PAGC Tokens. - - - + + NUMBER + + (0). A string of digits. + + - + + ORD + + (15). Representations such as First or 1st. Often used in street names. + + + + + ORD + + (18). A single letter. + + - - + + WORD + + (1). A word is a string of letters of arbitrary length. A single letter can be both a SINGLE and a WORD. + + + + + + + Output Tokens + After the first -1 (terminator), follows the output tokens and their order, followed by a terminator -1. Numbers for corresponding output tokens are listed in . + + + Rule Types and Rank + The final part of the rule is the rule type which is denoted by one of the following, followed by a rule rank which is a number from (1-17). + + + MACRO_C + + (token number = "0"). The class of rules for parsing MACRO clauses. + + + + MICRO_C + + (token number = "1"). The class of rules for parsing full MICRO clauses (ie ARC_C plus CIVIC_C). These rules are not used in the build phase. + + + + ARC_C + + (token number = "2"). The class of rules for parsing MICRO clauses, excluding the HOUSE attribute. + + + + CIVIC_C + + (token number = "3"). The class of rules for parsing the HOUSE attribute. + + + + EXTRA_C + + (token number = "4"). The class of rules for parsing EXTRA attributes - attributes excluded from geocoding. These rules are not used in the build phase. + + + + + + + + + lex table + A lex table is used to classify alphanumeric input and associate that input with (a) input tokens ( See Input Tokens) and (b) standardized representations. + + + Description + A lex (short for lexicon) table is used to classify alphanumeric input and associate that input with (a) input tokens and (b) standardized representations. Things you will find in these tables are ONE mapped to stdworkd: 1. + + A lex has at least the following columns in the table. You may add + + + id + + Primary key of table + + + seq + + integer: definition number? + + + + word + + text: the input word + + + stdword + + text: the standardized replacement word + + + token + + integer: the kind of word it is. Only if it is used in this context will it be replaced. Refer to PAGC Tokens. + + + + + + + + + gaz table + A gaz table is used to standardize place names and associate that input with (a) input tokens ( See Input Tokens) and (b) standardized representations. + + + Description + A gaz (short for gazeteer) table is used to classify place names and associate that input with (a) input tokens and (b) standardized representations. For example if you are in US, you may load these with State Names and associated abbreviations. + + A gaz table has at least the following columns in the table. You may add more columns if you wish for your own purposes. + + + id + + Primary key of table + + + seq + + integer: definition number? + + + word + + text: the input word + + + stdword + + text: the standardized replacement word + + + token + + integer: the kind of word it is. Only if it is used in this context will it be replaced. Refer to PAGC Tokens. + + + + + + + + Address Standardizer Functions