public class Mapping extends Object
PS1 instructions: do NOT change the method signatures or specifications of these methods, but you should implement their method bodies, and you may add new public or private methods or classes if you like.
| Modifier and Type | Method and Description |
|---|---|
static Set<String> |
findCategories(PointOfInterest pointOfInterest,
Map<String,Set<String>> categoryKeywords)
Find categories applicable to a point of interest (POI) by searching
their names and descriptions.
|
static Map<PointOfInterest,List<PointOfInterest>> |
reduceDuplicates(List<PointOfInterest> pointsOfInterest)
Guess which points of interest (POIs) are duplicates that represent the
same physical place.
|
public static Set<String> findCategories(PointOfInterest pointOfInterest, Map<String,Set<String>> categoryKeywords)
Category names and keywords must be nonempty strings of letters (A-Z, a-z), digits (0-9), underscores ("_"), hyphens ("-"), or spaces (" ").
Category names and keywords are case-insensitive. For example, the category name or keyword "supermarket" is the same as "SuperMarket", and "Rob's SUPERmarket" contains it. A name or keyword should appear at most once as an element in a set, or as a key in a map; it may not appear multiple times with different case.
pointOfInterest - POI to categorizecategoryKeywords - a map, not modified by this method, that maps
category names to a set of keywords for that categorypublic static Map<PointOfInterest,List<PointOfInterest>> reduceDuplicates(List<PointOfInterest> pointsOfInterest)
This method identifies groups of POIs in the input list that appear to be duplicative, and picks a best entry from the group. That entry is a key in the returned map, and its value is a list of the other duplicates in the group.
POIs are identified as duplicates if and only if their location, name, and/or description provide evidence that they represent the same physical place. POIs with exactly the same latitude, longitude, and name must be identified as duplicates. Other evidence may be used at the implementor's discretion.
pointsOfInterest - a list of POIs, not modified by this method