Addresses
Address blocks and one-line addresses: recipient, street or post office box with building, suite or mail stop, city, state, postal code and country.
Advanced Systems Center (ASC) 12201 Sunrise Valley Drive Reston, VA 20192 United States National Geospatial Technical Operations Center — Denver 810 Eighth Street Lakewood, CO 80225-0046 United States National Geospatial Technical Operations Center — Rolla 1400 Independence Road Rolla, MO 65401 United States USGS Denver Library Box 25046, MS 914 Denver Federal Center Denver, CO 80225-0046 United States
addresses.ymlspec
# Postal addresses of the United States and Canada. # # Values: StreetAddress (a numbered street, a numbered route or a post office box) and Locality # (city, state or province and postal code). Fact: Address, which composes them with the recipient # name, unit designators (suite, room, building, floor, mail stop), the named facility after the street # line and the country, in a block of lines or on one line. StreetAddress: $local: HouseNumber: '\d+[A-Z]?(-\d+[A-Z]?)?' Direction: - '[NS][EW]' - 'N\.[EW]\.' - 'S\.[EW]\.' - '[NSEW]\.?' - '(North|South)(east|west)?' - 'East' - 'West' $fields: { number: HouseNumber } Street: $local: Suffix: $flags: [ CASE_INSENSITIVE ] $patterns: - 'Street' - 'St' - 'Avenue' - 'Ave' - 'Road' - 'Rd' - 'Drive' - 'Dr' - 'Boulevard' - 'Blvd' - 'Lane' - 'Ln' - 'Way' - 'Court' - 'Ct' - 'Place' - 'Pl' - 'Parkway' - 'Pkwy' - 'Circle' - 'Cir' - 'Terrace' - 'Trail' - 'Pike' - 'Plaza' - 'Square' - 'Loop' - 'Crescent' - 'Expressway' - 'Turnpike' StreetName: '([\p{Lu}\d][\p{L}\d''.-]* )+${Suffix}\.?(,? ${Direction})?' $fields: { name: StreetName } $patterns: '#{number} #{name}' Route: $local: RouteName: '((U\.?S\.?|State|County|Interstate|Farm to Market|Ranch Road) )?(Highway|Hwy\.?|Route|Rte\.?|Road) \d+[A-Z]?( ${Direction})?' $fields: { name: RouteName } $patterns: '#{number} #{name}' PostBox: $local: BoxNumber: '\d+' $fields: { number: BoxNumber } $patterns: - '(P\.? ?O\.? ?|Post Office )?(Box|BOX) #{number}' - 'POB #{number}' Locality: $local: City: '\p{Lu}[\p{L}''.-]*( (\p{Lu}[\p{L}''.-]*|de|du|des|la|le|d''\p{Lu}\p{L}*))*' PostalCode: Zip: '\d{5}([-–]\d{4})?' Canadian: '[A-Z]\d[A-Z] ?\d[A-Z]\d' State: Alabama: { $patterns: [ 'AL', 'Alabama' ], $value: 'AL' } Alaska: { $patterns: [ 'AK', 'Alaska' ], $value: 'AK' } Arizona: { $patterns: [ 'AZ', 'Arizona' ], $value: 'AZ' } Arkansas: { $patterns: [ 'AR', 'Arkansas' ], $value: 'AR' } California: { $patterns: [ 'CA', 'California' ], $value: 'CA' } Colorado: { $patterns: [ 'CO', 'Colorado' ], $value: 'CO' } Connecticut: { $patterns: [ 'CT', 'Connecticut' ], $value: 'CT' } Delaware: { $patterns: [ 'DE', 'Delaware' ], $value: 'DE' } DistrictOfColumbia: { $patterns: [ 'DC', 'D\.C', 'District of Columbia' ], $value: 'DC' } Florida: { $patterns: [ 'FL', 'Florida' ], $value: 'FL' } Georgia: { $patterns: [ 'GA', 'Georgia' ], $value: 'GA' } Hawaii: { $patterns: [ 'HI', 'Hawaii' ], $value: 'HI' } Idaho: { $patterns: [ 'ID', 'Idaho' ], $value: 'ID' } Illinois: { $patterns: [ 'IL', 'Illinois' ], $value: 'IL' } Indiana: { $patterns: [ 'IN', 'Indiana' ], $value: 'IN' } Iowa: { $patterns: [ 'IA', 'Iowa' ], $value: 'IA' } Kansas: { $patterns: [ 'KS', 'Kansas' ], $value: 'KS' } Kentucky: { $patterns: [ 'KY', 'Kentucky' ], $value: 'KY' } Louisiana: { $patterns: [ 'LA', 'Louisiana' ], $value: 'LA' } Maine: { $patterns: [ 'ME', 'Maine' ], $value: 'ME' } Maryland: { $patterns: [ 'MD', 'Maryland' ], $value: 'MD' } Massachusetts: { $patterns: [ 'MA', 'Massachusetts' ], $value: 'MA' } Michigan: { $patterns: [ 'MI', 'Michigan' ], $value: 'MI' } Minnesota: { $patterns: [ 'MN', 'Minnesota' ], $value: 'MN' } Mississippi: { $patterns: [ 'MS', 'Mississippi' ], $value: 'MS' } Missouri: { $patterns: [ 'MO', 'Missouri' ], $value: 'MO' } Montana: { $patterns: [ 'MT', 'Montana' ], $value: 'MT' } Nebraska: { $patterns: [ 'NE', 'Nebraska' ], $value: 'NE' } Nevada: { $patterns: [ 'NV', 'Nevada' ], $value: 'NV' } NewHampshire: { $patterns: [ 'NH', 'New Hampshire' ], $value: 'NH' } NewJersey: { $patterns: [ 'NJ', 'New Jersey' ], $value: 'NJ' } NewMexico: { $patterns: [ 'NM', 'New Mexico' ], $value: 'NM' } NewYork: { $patterns: [ 'NY', 'New York' ], $value: 'NY' } NorthCarolina: { $patterns: [ 'NC', 'North Carolina' ], $value: 'NC' } NorthDakota: { $patterns: [ 'ND', 'North Dakota' ], $value: 'ND' } Ohio: { $patterns: [ 'OH', 'Ohio' ], $value: 'OH' } Oklahoma: { $patterns: [ 'OK', 'Oklahoma' ], $value: 'OK' } Oregon: { $patterns: [ 'OR', 'Oregon' ], $value: 'OR' } Pennsylvania: { $patterns: [ 'PA', 'Pennsylvania' ], $value: 'PA' } RhodeIsland: { $patterns: [ 'RI', 'Rhode Island' ], $value: 'RI' } SouthCarolina: { $patterns: [ 'SC', 'South Carolina' ], $value: 'SC' } SouthDakota: { $patterns: [ 'SD', 'South Dakota' ], $value: 'SD' } Tennessee: { $patterns: [ 'TN', 'Tennessee' ], $value: 'TN' } Texas: { $patterns: [ 'TX', 'Texas' ], $value: 'TX' } Utah: { $patterns: [ 'UT', 'Utah' ], $value: 'UT' } Vermont: { $patterns: [ 'VT', 'Vermont' ], $value: 'VT' } Virginia: { $patterns: [ 'VA', 'Virginia' ], $value: 'VA' } Washington: { $patterns: [ 'WA', 'Washington' ], $value: 'WA' } WestVirginia: { $patterns: [ 'WV', 'West Virginia' ], $value: 'WV' } Wisconsin: { $patterns: [ 'WI', 'Wisconsin' ], $value: 'WI' } Wyoming: { $patterns: [ 'WY', 'Wyoming' ], $value: 'WY' } AmericanSamoa: { $patterns: [ 'AS', 'American Samoa' ], $value: 'AS' } Guam: { $patterns: [ 'GU', 'Guam' ], $value: 'GU' } NorthernMarianaIslands: { $patterns: [ 'MP', 'Northern Mariana Islands' ], $value: 'MP' } PuertoRico: { $patterns: [ 'PR', 'Puerto Rico' ], $value: 'PR' } VirginIslands: { $patterns: [ 'VI', '(U\.S\. )?Virgin Islands' ], $value: 'VI' } Alberta: { $patterns: [ 'AB', 'Alberta' ], $value: 'AB' } BritishColumbia: { $patterns: [ 'BC', 'British Columbia' ], $value: 'BC' } Manitoba: { $patterns: [ 'MB', 'Manitoba' ], $value: 'MB' } NewBrunswick: { $patterns: [ 'NB', 'New Brunswick' ], $value: 'NB' } NewfoundlandAndLabrador: { $patterns: [ 'NL', 'Newfoundland and Labrador', 'Newfoundland' ], $value: 'NL' } NovaScotia: { $patterns: [ 'NS', 'Nova Scotia' ], $value: 'NS' } NorthwestTerritories: { $patterns: [ 'NT', 'Northwest Territories' ], $value: 'NT' } Nunavut: { $patterns: [ 'NU', 'Nunavut' ], $value: 'NU' } Ontario: { $patterns: [ 'ON', 'Ontario' ], $value: 'ON' } PrinceEdwardIsland: { $patterns: [ 'PE', 'Prince Edward Island' ], $value: 'PE' } Quebec: { $patterns: [ 'QC', 'Quebec', 'Québec' ], $value: 'QC' } Saskatchewan: { $patterns: [ 'SK', 'Saskatchewan' ], $value: 'SK' } Yukon: { $patterns: [ 'YT', 'Yukon' ], $value: 'YT' } $fields: { city: City, state: State, postalCode: PostalCode } $patterns: - '#{city},? #{state}\.?,? +#{postalCode}' - '#{city} \(#{state}\) +#{postalCode}' Unit: MailStop: '(MS|M/S|Mail ?[Ss]top|Mail [Cc]ode|MC)\.? ?#?[A-Z]?\d+[A-Z\d-]*' Suite: '(Suite|Ste\.?|STE) #?[A-Z\d][A-Z\d-]*' Room: '(Room|Rm\.?) #?[A-Z\d][A-Z\d-]*' Building: '(Building|Bldg\.?) #?[A-Z\d][A-Z\d-]*' Floor: - '\d+(st|nd|rd|th) (Floor|Fl\.?)' - '(Floor|Fl\.?) \d+' Apartment: '(Apartment|Apt\.?|Unit) #?[A-Z\d][A-Z\d-]*' Address: $local: Separator: '(,? *\n *|, )' Label: $flags: [ CASE_INSENSITIVE ] $patterns: '((Mailing|Postal|Street|Physical|Shipping|Delivery|Office|Our) )?Address' NameLine: '[\p{L}\d(][\p{L}\d ().&''’—–-]*[\p{L}\d)]' Facility: '(\p{Lu}[\p{L}''.&-]* )+(Center|Centre|Building|Plaza|Complex|Campus|Tower|Park|Hall|Annex|Station|Laboratory|Arsenal|Courthouse)' Country: UnitedStates: $patterns: - 'United States( of America)?' - 'U\.S\.A\.?' - 'USA' - 'U\.S\.' - 'US' $value: 'United States' Canada: { $patterns: [ 'Canada', 'CANADA' ], $value: 'Canada' } $fields: name: 'NameLine[]' street: StreetAddress units: 'Unit[]' facility: Facility locality: Locality country: Country $patterns: '(${Label}:? *\n? *)?(#{name}${Separator})*(#{units}${Separator})*#{street}((${Separator}| )(#{units}|#{facility}))*${Separator}#{locality}((${Separator}| )#{country})?'
$ texomy parse input.txt -m addressesAbout this spec
Postal addresses of the United States and Canada, as blocks or on one line: the recipient name, the street address or post office box with any building, suite or mail stop, the city, the state or province, the postal code and the country.
Package files
addresses.ymlsamples/blocks.txtsamples/inline.txttests/addresses.test.ymltests/expected/blocks.yamltests/expected/inline.yamltests/expected/sample.yamltexomy.json
41 nodes from 4 top-level matches.
Run it yourself
Save the example from Studio to a folder, then in that folder:
texomy parse input.txt -m addressestexomy testMore examples
Invoices
Supplier, invoice number, dates, amounts, payment terms and order references, plus charge rows that take their section from the table caption.
Bank statements
Account, period and balance summary, and transactions read from a table whose Debit and Credit columns give each amount its sign.
Education
Student, identifier, institution and print date in any order, and each term with its courses, grades, credit hours and totals.
Logistics
Bills of lading: references, vehicles, sender and receiver with addresses, cargo lines with count, kind and mass, and the totals, in whatever order the document states them.
Resumes
Candidate name, headline and contacts, each job and degree with its own dates, courses, and skills grouped under their area.
Insurance claims
Explanation of Benefits tables: each claim line with service dates, description, status and every amount in its own field, the totals line as a type of its own, and the remark codes explained below.
Write the spec once. Run it on everything.
Install the CLI, connect your agent, and turn your first sample into typed data in minutes.
brew install texomy/tap/texomy