goloc

package module
v0.0.0-...-c2760ec Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2015 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Copyright 2015 Mathieu MAST. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(a int) int

func Clean

func Clean(source string, stopWords container.Container) string

func CompareScoreResult

func CompareScoreResult(r1, r2 interface{}) int

func ContainerScore

func ContainerScore(searchWords container.Container, reference string) int

func DefaultFilter

func DefaultFilter(result *Result) bool

func Distance

func Distance(search, reference string) int

func GobRegister

func GobRegister()

func MSplit

func MSplit(source string) container.Container

func Max

func Max(a int, b int) int

func Min

func Min(a int, b int) int

func Partialphone

func Partialphone(source string) string

func PartialphoneWriteLast

func PartialphoneWriteLast(b *bytes.Buffer, ptrCurrentRune, ptrLastRune, ptrPenultimateRune *rune)

func Split

func Split(source string) container.Container

func StrScore

func StrScore(search string, reference string) int

func UpperUnaccentUnpunctRune

func UpperUnaccentUnpunctRune(r rune) rune

func UpperUnaccentUnpunctString

func UpperUnaccentUnpunctString(str string) string

Types

type Bound

type Bound struct {
	PointMin Point
	PointMax Point
}

func NewBound

func NewBound() *Bound

type ConcurrentSniffer

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

func NewConcurrentSniffer

func NewConcurrentSniffer(index Index) *ConcurrentSniffer

func (*ConcurrentSniffer) Search

func (s *ConcurrentSniffer) Search(parameters Parameters) (container.Container, error)

type Filter

type Filter func(*Result) bool

Filter function type. If return value false, the result is removed.

type Index

type Index interface {
	Sniffer
	// Add new locations
	Add(...Location)
	// Get location
	Get(string) Location
	// Get ids number for key
	GetNbIds(string) int
	// // Get ids for key
	GetIds(string) container.Container
	// Add new stop word
	AddStopWord(...string)
	// Get stop words
	GetStopWords() container.Container
	// Get encoded stop words
	GetEncodedStopWords() container.Container
}

type Location

type Location interface {
	// Get unique identifier.
	GetId() string
	// Get cleaned name
	GetCleanedName() string
	// Set cleaned name
	SetCleanedName(string)
	// Get phonetic encoded name
	GetEncodedName() string
	// Set phonetic encoded name
	SetEncodedName(string)
	// Get name to indexing it.
	GetName() string
	// Get type (street, poi, zone...).
	GetType() string
	// Get latitude
	GetLat() float32
	// Get lLongitude
	GetLon() float32
}

Location definition.

type Memindex

type Memindex struct {
	Locations        *container.Map
	Keys             *container.Map
	StopWords        *container.Set
	EncodedStopWords *container.Set
	// contains filtered or unexported fields
}

func NewMemindex

func NewMemindex() *Memindex

func NewMemindexFromFile

func NewMemindexFromFile(filename string) *Memindex

func (*Memindex) Add

func (mi *Memindex) Add(locs ...Location)

func (*Memindex) AddStopWord

func (mi *Memindex) AddStopWord(words ...string)

func (*Memindex) Clear

func (mi *Memindex) Clear()

func (*Memindex) Get

func (mi *Memindex) Get(id string) Location

func (*Memindex) GetEncodedStopWords

func (mi *Memindex) GetEncodedStopWords() container.Container

func (*Memindex) GetIds

func (mi *Memindex) GetIds(key string) container.Container

func (*Memindex) GetNbIds

func (mi *Memindex) GetNbIds(key string) int

func (*Memindex) GetStopWords

func (mi *Memindex) GetStopWords() container.Container

func (*Memindex) SaveInFile

func (mi *Memindex) SaveInFile(filename string)

func (*Memindex) Search

func (mi *Memindex) Search(parameters Parameters) (container.Container, error)

type NumberedPoint

type NumberedPoint interface {
	// Get string number
	GetNumber() string
	// Get latitude
	GetLat() float32
	// Get longitude
	GetLon() float32
}

Numbered point definition.

type NumberedPointBag

type NumberedPointBag interface {
	// Get number points
	GetNumberedPoints() container.Container
}

Numbered definition.

type Parameters

type Parameters map[string]interface{}

type Poi

type Poi struct {
	Id          string
	EncodedName string
	CleanedName string
	PoiName     string
	PoiType     string
	Zone        *Zone
	Point
}

func NewPoi

func NewPoi(id string, poiName string, poiType string, zone *Zone, lat float32, lon float32) *Poi

func (*Poi) GetCleanedName

func (p *Poi) GetCleanedName() string

func (*Poi) GetEncodedName

func (p *Poi) GetEncodedName() string

func (*Poi) GetId

func (p *Poi) GetId() string

func (*Poi) GetLat

func (p *Poi) GetLat() float32

func (*Poi) GetLon

func (p *Poi) GetLon() float32

func (*Poi) GetName

func (p *Poi) GetName() string

func (*Poi) GetType

func (p *Poi) GetType() string

func (*Poi) SetCleanedName

func (p *Poi) SetCleanedName(cleanedName string)

func (*Poi) SetEncodedName

func (p *Poi) SetEncodedName(encodedName string)

type Point

type Point struct {
	Lat float32
	Lon float32
}

func NewPoint

func NewPoint() *Point

type Result

type Result struct {
	Score         int
	Search        string
	CleanedSearch string
	Id            string
	Type          string
	Name          string
	CleanedName   string
	Number        string
	Point
}

type Sniffer

type Sniffer interface {
	// Search
	Search(Parameters) (container.Container, error)
}

type Street

type Street struct {
	Id          string
	EncodedName string
	CleanedName string
	StreetName  string
	Zone        *Zone
	Point
	NumberedPoints *container.LinkedList
}

func NewStreet

func NewStreet(id string, streetName string, zone *Zone, lat float32, lon float32) *Street

func (*Street) AddNumberedPoint

func (s *Street) AddNumberedPoint(numberedPoint *StreetNumberedPoint)

func (*Street) GetCleanedName

func (s *Street) GetCleanedName() string

func (*Street) GetEncodedName

func (s *Street) GetEncodedName() string

func (*Street) GetId

func (s *Street) GetId() string

func (*Street) GetLat

func (s *Street) GetLat() float32

func (*Street) GetLon

func (s *Street) GetLon() float32

func (*Street) GetName

func (s *Street) GetName() string

func (*Street) GetNumberedPoints

func (s *Street) GetNumberedPoints() container.Container

func (*Street) GetType

func (s *Street) GetType() string

func (*Street) SetCleanedName

func (s *Street) SetCleanedName(cleanedName string)

func (*Street) SetEncodedName

func (s *Street) SetEncodedName(encodedName string)

type StreetNumberedPoint

type StreetNumberedPoint struct {
	Number string
	Point
}

func NewStreetNumberedPoint

func NewStreetNumberedPoint(number string, lat float32, lon float32) *StreetNumberedPoint

func (*StreetNumberedPoint) GetLat

func (np *StreetNumberedPoint) GetLat() float32

func (*StreetNumberedPoint) GetLon

func (np *StreetNumberedPoint) GetLon() float32

func (*StreetNumberedPoint) GetNumber

func (np *StreetNumberedPoint) GetNumber() string

type Zone

type Zone struct {
	Id          string
	EncodedName string
	CleanedName string
	Postcode    string
	Settlement  string
	City        string
	Region      string
	Country     string
	Bound
}

func NewZone

func NewZone(id string, postcode string, settlement string, city string, region string, country string, latMin float32, lonMin float32, latMax float32, lonMax float32) *Zone

func (*Zone) GetCleanedName

func (z *Zone) GetCleanedName() string

func (*Zone) GetEncodedName

func (z *Zone) GetEncodedName() string

func (*Zone) GetId

func (z *Zone) GetId() string

func (*Zone) GetLat

func (z *Zone) GetLat() float32

func (*Zone) GetLon

func (z *Zone) GetLon() float32

func (*Zone) GetName

func (z *Zone) GetName() string

func (*Zone) GetType

func (z *Zone) GetType() string

func (*Zone) SetCleanedName

func (z *Zone) SetCleanedName(cleanedName string)

func (*Zone) SetEncodedName

func (z *Zone) SetEncodedName(encodedName string)

Jump to

Keyboard shortcuts

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