Documentation
¶
Index ¶
- Constants
- func ExpandAddress(address string) []string
- func ExpandAddressOptions(address string, options ExpandOptions) []string
- func Setup() error
- func SetupClassifier() error
- func SetupClassifierDataDir(dir string) error
- func SetupDataDir(dir string) error
- func SetupParser() error
- func SetupParserDataDir(dir string) error
- func Teardown()
- func TeardownClassifier()
- func TeardownParser()
- func Version() string
- type AddressComponent
- type ExpandOptions
- type ParsedComponent
- type ParserOptions
Constants ¶
const ( AddressComponentNone = AddressComponent(C.LIBPOSTAL_ADDRESS_NONE) AddressComponentAny = AddressComponent(C.LIBPOSTAL_ADDRESS_ANY) AddressComponentName = AddressComponent(C.LIBPOSTAL_ADDRESS_NAME) AddressComponentHouseNumber = AddressComponent(C.LIBPOSTAL_ADDRESS_HOUSE_NUMBER) AddressComponentStreet = AddressComponent(C.LIBPOSTAL_ADDRESS_STREET) AddressComponentUnit = AddressComponent(C.LIBPOSTAL_ADDRESS_UNIT) AddressComponentLevel = AddressComponent(C.LIBPOSTAL_ADDRESS_LEVEL) AddressComponentStaircase = AddressComponent(C.LIBPOSTAL_ADDRESS_STAIRCASE) AddressComponentEntrance = AddressComponent(C.LIBPOSTAL_ADDRESS_ENTRANCE) AddressComponentCategory = AddressComponent(C.LIBPOSTAL_ADDRESS_CATEGORY) AddressComponentNear = AddressComponent(C.LIBPOSTAL_ADDRESS_NEAR) AddressComponentToponym = AddressComponent(C.LIBPOSTAL_ADDRESS_TOPONYM) AddressComponentPostalCode = AddressComponent(C.LIBPOSTAL_ADDRESS_POSTAL_CODE) AddressComponentPoBox = AddressComponent(C.LIBPOSTAL_ADDRESS_PO_BOX) AddressComponentAll = AddressComponent(C.LIBPOSTAL_ADDRESS_ALL) )
Variables ¶
This section is empty.
Functions ¶
func ExpandAddress ¶
ExpandAddress expands an address (using libpostal_expand_address) with default options.
func ExpandAddressOptions ¶
func ExpandAddressOptions(address string, options ExpandOptions) []string
ExpandAddressOptions expands an address (using libpostal_expand_address) with custom options.
func Setup ¶
func Setup() error
Setup initializes libpostal using default data directory (defined at libpostal's compile-time).
func SetupClassifier ¶
func SetupClassifier() error
SetupClassifier initializes the language classifier using default data directory (defined at libpostal's compile-time).
func SetupClassifierDataDir ¶
SetupClassifierDataDir initializes the language classifier using a custom data directory.
func SetupDataDir ¶
SetupDataDir initializes libpostal using a custom data directory.
func SetupParser ¶
func SetupParser() error
SetupParserDataDir initializes the address parser using a custom data directory.
func SetupParserDataDir ¶
SetupParserDataDir initializes the address parser using a custom data directory.
func TeardownClassifier ¶
func TeardownClassifier()
TeardownClassifier frees all resources allocated by SetupClassifier or SetupClassifierDataDir.
func TeardownParser ¶
func TeardownParser()
TeardownParser frees all resources allocated by SetupParser or SetupParserDataDir.
Types ¶
type AddressComponent ¶
type AddressComponent uint16
type ExpandOptions ¶
type ExpandOptions struct { Languages []string AddressComponents AddressComponent LatinASCII bool Transliterate bool StripAccents bool Decompose bool Lowercase bool TrimString bool ReplaceWordHyphens bool DeleteWordHyphens bool ReplaceNumericHyphens bool DeleteNumericHyphens bool SplitAlphaFromNumeric bool DeleteFinalPeriods bool DeleteAcronymPeriods bool DropEnglishPossessives bool DeleteApostrophes bool ExpandNumex bool RomanNumerals bool }
ExpandOptions are the options used with ExpandAddressOptions.
func DefaultExpandOptions ¶
func DefaultExpandOptions() ExpandOptions
DefaultExpandOptions returns the default ParserOptions.
type ParsedComponent ¶
ParsedComponent represents a parsed address component returned by ParseAddress* functions.
func ParseAddress ¶
func ParseAddress(address string) []ParsedComponent
ParseAddress parses an address (using libpostal_parse_address) with default options.
func ParseAddressOptions ¶
func ParseAddressOptions(address string, options ParserOptions) []ParsedComponent
ParseAddressOptions parses an address (using libpostal_parse_address) with custom options.
type ParserOptions ¶
ParserOptions are the options used with ParserAddressOptions.
func DefaultParserOptions ¶
func DefaultParserOptions() ParserOptions
DefaultParserOptions returns the default ParserOptions.