Documentation ¶
Overview ¶
Package matching score design doc: https://bit.ly/2OTuBhM
Package matching matches request from planner for a particular day
Index ¶
- Constants
- func AveragePricing(priceLevel POI.PriceLevel) float64
- func KnapsackMatrixCopy(dst [][]knapsackNode, src [][]knapsackNode)
- func MatchClusterCenters(eClusterCenters [][]float64, vClusterCenters [][]float64) (pairs []clusterCenterPair, err error)
- func PlaceScore(place Place) float64
- func Score(places []Place, distNorm int) float64
- func ScoreOld(places []Place) float64
- type FilterCriteria
- type FilterRequest
- type Matcher
- type MatcherForPriceRange
- type MatcherForTime
- type MatcherForUserRatings
- type Place
- func CreatePlace(place POI.Place, category POI.PlaceCategory) Place
- func Knapsack(places []Place, interval TimeInterval, budget uint) (results []Place, totalCost uint, totalTimeSpent uint8)
- func KnapsackV1(places []Place, interval TimeInterval, budget uint) (results []Place)
- func NearbySearchForCategory(ctx context.Context, searcher iowrappers.SearchClient, req *Request) ([]Place, error)
- func (place *Place) Hours() [7]string
- func (place *Place) Id() string
- func (place *Place) IsOpenBetween(interval TimeInterval, stayingDurationInHour uint8) bool
- func (place *Place) Location() POI.Location
- func (place *Place) Name() string
- func (place *Place) PlaceAddress() string
- func (place *Place) PlaceCategory() POI.PlaceCategory
- func (place *Place) PlacePrice() float64
- func (place *Place) Rating() float32
- func (place *Place) SetCategory(category POI.PlaceCategory)
- func (place *Place) SetURL(url string)
- func (place *Place) Type() POI.LocationType
- func (place *Place) Url() string
- func (place *Place) UserRatingsCount() int
- type PlacesClusterForTime
- type PriceRangeFilterParams
- type Request
- type TimeFilterParams
- type TimeInterval
- type TimeSlot
- type UserRatingFilterParams
Constants ¶
View Source
const ( PriceZeroMean = 0.0 PriceOneMean = 10.0 PriceTwoMean = 30.0 PriceThreeMean = 50.0 PriceFourMean = 100.0 PriceDefaultMean = PriceTwoMean )
View Source
const (
MaxPlaceRating = 5.0
)
View Source
const SelectionThreshold = -1
Variables ¶
This section is empty.
Functions ¶
func AveragePricing ¶
func AveragePricing(priceLevel POI.PriceLevel) float64
AveragePricing returns expected price of the price level
func KnapsackMatrixCopy ¶
func KnapsackMatrixCopy(dst [][]knapsackNode, src [][]knapsackNode)
func MatchClusterCenters ¶
func PlaceScore ¶
Types ¶
type FilterCriteria ¶
type FilterCriteria string
FilterCriteria is an enum for various points of interest filtering criteria
const ( MinResultsForTimePeriodMatching = 20 FilterByTimePeriod FilterCriteria = "filterByTimePeriod" FilterByPriceRange FilterCriteria = "filterByPriceRange" FilterByUserRating FilterCriteria = "filterByUserRating" )
type FilterRequest ¶
type FilterRequest struct { Places []Place Params map[FilterCriteria]interface{} }
type Matcher ¶
type Matcher interface { Match(req *FilterRequest) (places []Place, err error) MatcherName() string }
type MatcherForPriceRange ¶
type MatcherForPriceRange struct { }
func (MatcherForPriceRange) Match ¶
func (matcher MatcherForPriceRange) Match(req *FilterRequest) ([]Place, error)
func (MatcherForPriceRange) MatcherName ¶
func (matcher MatcherForPriceRange) MatcherName() string
type MatcherForTime ¶
type MatcherForTime struct { }
func (MatcherForTime) Match ¶
func (m MatcherForTime) Match(req *FilterRequest) ([]Place, error)
func (MatcherForTime) MatcherName ¶
func (m MatcherForTime) MatcherName() string
type MatcherForUserRatings ¶
type MatcherForUserRatings struct { }
func (MatcherForUserRatings) Match ¶
func (m MatcherForUserRatings) Match(req *FilterRequest) ([]Place, error)
func (MatcherForUserRatings) MatcherName ¶
func (m MatcherForUserRatings) MatcherName() string
type Place ¶
type Place struct { Place *POI.Place Category POI.PlaceCategory `json:"category"` Address string `json:"address"` Price float64 `json:"price"` }
func CreatePlace ¶
func CreatePlace(place POI.Place, category POI.PlaceCategory) Place
func Knapsack ¶
func Knapsack(places []Place, interval TimeInterval, budget uint) (results []Place, totalCost uint, totalTimeSpent uint8)
KnapsackV1 v2 uses sparse matrix like storage for step values and saves memory KnapsackV1 v1 is migrated to knapsack_old_test_only.go
func KnapsackV1 ¶
func KnapsackV1(places []Place, interval TimeInterval, budget uint) (results []Place)
func NearbySearchForCategory ¶
func NearbySearchForCategory(ctx context.Context, searcher iowrappers.SearchClient, req *Request) ([]Place, error)
func (*Place) IsOpenBetween ¶
func (place *Place) IsOpenBetween(interval TimeInterval, stayingDurationInHour uint8) bool
func (*Place) PlaceAddress ¶
func (*Place) PlaceCategory ¶
func (place *Place) PlaceCategory() POI.PlaceCategory
func (*Place) PlacePrice ¶
func (*Place) SetCategory ¶
func (place *Place) SetCategory(category POI.PlaceCategory)
func (*Place) Type ¶
func (place *Place) Type() POI.LocationType
func (*Place) UserRatingsCount ¶
type PlacesClusterForTime ¶
type PriceRangeFilterParams ¶
type PriceRangeFilterParams struct { Category POI.PlaceCategory PriceLevel POI.PriceLevel }
type Request ¶
type Request struct { Radius uint Location POI.Location Category POI.PlaceCategory UsePreciseLocation bool PriceLevel POI.PriceLevel }
type TimeFilterParams ¶
type TimeFilterParams struct { Day POI.Weekday TimeInterval POI.TimeInterval }
type TimeInterval ¶
func (*TimeInterval) AddOffsetHours ¶
func (interval *TimeInterval) AddOffsetHours(offsetHour uint8) (intervalOut TimeInterval, valid bool)
type TimeSlot ¶
type TimeSlot struct {
Slot POI.TimeInterval `json:"slot"`
}
type UserRatingFilterParams ¶
type UserRatingFilterParams struct {
MinUserRatings int
}
Click to show internal directories.
Click to hide internal directories.