place

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2024 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(name string) string

func CutLastElement

func CutLastElement(name string) (string, string)

func LastElement

func LastElement(name string) string

func Normalize

func Normalize(name string) string

Types

type Hint

type Hint interface {
	ID() string // a unique identifier for the hint
}

type PlaceHierarchy

type PlaceHierarchy struct {
	// contains filtered or unexported fields
}

func (*PlaceHierarchy) CutLast

func (p *PlaceHierarchy) CutLast() (*PlaceHierarchy, string)

func (*PlaceHierarchy) Last

func (p *PlaceHierarchy) Last() (string, bool)

type PlaceKind

type PlaceKind string
const (
	PlaceKindUnknown  PlaceKind = "unknown"
	PlaceKindCountry  PlaceKind = "country"
	PlaceKindUKNation PlaceKind = "uknation"
	PlaceKindAddress  PlaceKind = "address"
)

type PlaceName

type PlaceName struct {
	ID         string
	Kind       PlaceKind
	Name       string
	Adjective  string
	Aliases    []string
	Unknown    bool
	ChildHints []Hint
	PartOf     []*PlaceName
}

func ClassifyName

func ClassifyName(name string, hints ...Hint) *PlaceName

func LookupPlaceName

func LookupPlaceName(v string) (*PlaceName, bool)

func UnknownPlaceName

func UnknownPlaceName() *PlaceName

func (*PlaceName) FindContainerKind

func (pn *PlaceName) FindContainerKind(kind PlaceKind) (*PlaceName, bool)

func (*PlaceName) IsUnknown

func (c *PlaceName) IsUnknown() bool

func (*PlaceName) SameAs

func (c *PlaceName) SameAs(other *PlaceName) bool

type PlaceNameHierarchy

type PlaceNameHierarchy struct {
	Name                    PlaceName
	Kind                    PlaceKind
	NormalizedWithHierarchy string
	Parent                  *PlaceNameHierarchy
	Child                   *PlaceNameHierarchy
}

func ParseNameHierarchy

func ParseNameHierarchy(s string, hints ...Hint) (*PlaceNameHierarchy, bool)

ParseNameHierarchy attempts to parse a placename into a hierarchy

func (*PlaceNameHierarchy) HasParent

func (p *PlaceNameHierarchy) HasParent() bool

func (*PlaceNameHierarchy) String

func (p *PlaceNameHierarchy) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL