Contents

enumerateNeighborsForVector:maximumCount:distanceType:usingBlock:

Passes the nearest strings of a location in the vocabulary space to a closure.

Declaration

- (void) enumerateNeighborsForVector:(NSArray<NSNumber *> *) vector maximumCount:(NSUInteger) maxCount 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 closure with the following parameters:

    neighbor

    A neighboring string.

    distance

    The distance from vector to the neighboring string.

    stop

    In Objective-C, a Boolean that indicates whether to stop enumerating neighbors.

See Also

Finding strings and their distances in an embedding