@RequiredVersion(value=1) public class USAddressParser extends java.lang.Object implements AddressParser
Modifier and Type | Class and Description |
---|---|
static class |
USAddressParser.USAddressParserBuilder
Builder class used to setup a
USAddressParser |
AddressParser.ParseHint
Modifier and Type | Field and Description |
---|---|
static java.util.Collection<java.lang.String> |
DEFAULT_COUNTRIES
A default set of countries
|
static java.util.Collection<java.lang.String> |
DEFAULT_END_ADDRESS_WORDS
A default set of end address words.
|
static AddressParser.ParseHint[] |
DEFAULT_HINTS |
static java.util.Collection<java.lang.String> |
DEFAULT_SECONDARY_ADDRESS_LINE_WORDS
A default set of secondary address line indicator words
|
static java.util.Collection<java.lang.String> |
DEFAULT_STATES
A default set of states
|
static java.lang.String |
DEFAULT_ZIP_CODE_PATTERN
The default pattern used for matching a zip code
|
static java.lang.String |
NUMERIC_SUFFIX
The suffix to get numeric values after a street name
|
static java.lang.String |
STANDARD_PREPEND
The standard prepend which is applied to MOST end address word patterns.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes any open resources in use by the parser
|
Address |
parse(java.lang.String address)
Attempts to parse the string given as an address.
|
Address |
parse(java.lang.String address,
AddressParser.ParseHint... hints)
Attempts to parse the string given as an address.
|
void |
setAutoCloseAfterScrapeEnds(ScrapingSession session)
Tells the data manager to close when the scrape ends.
|
public static final AddressParser.ParseHint[] DEFAULT_HINTS
public static final java.lang.String STANDARD_PREPEND
public static final java.lang.String NUMERIC_SUFFIX
public static final java.util.Collection<java.lang.String> DEFAULT_END_ADDRESS_WORDS
public static final java.util.Collection<java.lang.String> DEFAULT_SECONDARY_ADDRESS_LINE_WORDS
public static final java.util.Collection<java.lang.String> DEFAULT_COUNTRIES
public static final java.util.Collection<java.lang.String> DEFAULT_STATES
public static final java.lang.String DEFAULT_ZIP_CODE_PATTERN
@Nullable public Address parse(@NotNull java.lang.String address) throws java.text.ParseException
AddressParser
parse
in interface AddressParser
address
- The string to parse as an addressAddress
from the stringjava.text.ParseException
- If there is an error parsing the address. Not throwing the exception doesn't indicate we know the parse has correct data, but there
are some cases when we know the parsed data is invalid@Nullable public Address parse(@NotNull java.lang.String address, @NotNull AddressParser.ParseHint... hints) throws java.text.ParseException
AddressParser
parse
in interface AddressParser
address
- The string to parse as an addresshints
- The hints to use when parsingAddress
from the stringjava.text.ParseException
- If there is an error parsing the address. Not throwing the exception doesn't indicate we know the parse has correct data, but there
are some cases when we know the parsed data is invalidpublic void close()
AddressParser
close
in interface AddressParser
public void setAutoCloseAfterScrapeEnds(@NotNull ScrapingSession session)
AddressParser
setAutoCloseAfterScrapeEnds
in interface AddressParser
session
- The scraping session this should use to check for closing on completion