enumerateNeighborsForVector:maximumCount:maximumDistance:distanceType:usingBlock:
Passes the nearest strings, within a radius of a location in the vocabulary space, to a block.
Declaration
- (void) enumerateNeighborsForVector:(NSArray<NSNumber *> *) vector maximumCount:(NSUInteger) maxCount maximumDistance:(NLDistance) maxDistance distanceType:(NLDistanceType) distanceType usingBlock:(void (^)(NSString *neighbor, NLDistance distance, BOOL *stop)) block;Parameters
- vector:
A location in the vocabulary space.
- maxCount:
The largest number of times the method calls
block. - distanceType:
A means of calculating distance that determines which formula the method uses to evaluate a neighbor’s distance from
vector. - block:
A block with the following parameters:
neighborA neighboring string.
distanceThe distance from
vectorto the neighboring string.stopA Boolean that indicates whether to stop enumerating neighbors.
See Also
Finding strings and their distances in an embedding
neighborsForString:maximumCount:distanceType:neighborsForString:maximumCount:maximumDistance:distanceType:neighborsForVector:maximumCount:distanceType:neighborsForVector:maximumCount:maximumDistance:distanceType:enumerateNeighborsForString:maximumCount:distanceType:usingBlock:enumerateNeighborsForString:maximumCount:maximumDistance:distanceType:usingBlock:enumerateNeighborsForVector:maximumCount:distanceType:usingBlock:distanceBetweenString:andString:distanceType:NLDistance