neighborsForVector:maximumCount:distanceType:
Retrieves a limited number of strings near a location in the vocabulary space.
Declaration
- (NSArray<NSString *> *) neighborsForVector:(NSArray<NSNumber *> *) vector maximumCount:(NSUInteger) maxCount distanceType:(NLDistanceType) distanceType;Parameters
- vector:
A location in the vocabulary space.
- maxCount:
The largest number of neighboring strings that the method can return in an array.
- distanceType:
A means of calculating distance that determines which formula the method uses to evaluate a neighbor’s distance from
vector.
Return Value
An array of tuples that contain neighboring strings and their distances. In Objective-C, this returns an array of neighboring strings.
See Also
Finding strings and their distances in an embedding
neighborsForString:maximumCount:distanceType:neighborsForString:maximumCount:maximumDistance:distanceType:neighborsForVector:maximumCount:maximumDistance:distanceType:enumerateNeighborsForString:maximumCount:distanceType:usingBlock:enumerateNeighborsForString:maximumCount:maximumDistance:distanceType:usingBlock:enumerateNeighborsForVector:maximumCount:distanceType:usingBlock:enumerateNeighborsForVector:maximumCount:maximumDistance:distanceType:usingBlock:distanceBetweenString:andString:distanceType:NLDistance