Contents

neighborsForVector:maximumCount:maximumDistance:distanceType:

Retrieves a limited number of strings within a radius of a location in the vocabulary space.

Declaration

- (NSArray<NSString *> *) neighborsForVector:(NSArray<NSNumber *> *) vector maximumCount:(NSUInteger) maxCount maximumDistance:(NLDistance) maxDistance 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.

  • maxDistance:

    The largest distance a neighbor can be from vector.

  • 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 strings.

See Also

Finding strings and their distances in an embedding