Instance Method

enumerateNeighborsForString:maximumCount:distanceType:usingBlock:

Enumerates the nearest neighbors of a string, given a closure, a number of neighbors, and a distance type.

Declaration

- (void)enumerateNeighborsForString:(NSString *)string maximumCount:(NSUInteger)maxCount distanceType:(NLDistanceType)distanceType usingBlock:(void (^)(NSString *neighbor, NLDistance distance, BOOL *stop))block;

Parameters

string

A string in the embedding vocabulary.

maxCount

The largest number of neighboring strings to find.

distanceType

The type of distance, which determines the formula the method uses to calculate distance.

block

A closure that enumerates the nearest neighbors of the given string.

String

A neighboring string.

NLDistance

The distance of the neighboring string

See Also

Finding Strings in an Embedding

NLDistance

The distance between two strings in a text embedding.

- distanceBetweenString:andString:distanceType:

Calculates the distance between two strings.

- neighborsForString:maximumCount:distanceType:

Retrieves the nearest neighbors of a string, given a number of neighbors and a distance type.

- neighborsForString:maximumCount:maximumDistance:distanceType:

Retrieves the nearest neighbors of a string, given a distance, a number of neighbors, and a distance type.

- neighborsForVector:maximumCount:distanceType:

Retrieves the nearest strings to a vector, given a number of neighbors and a distance type.

- neighborsForVector:maximumCount:maximumDistance:distanceType:

Retrieves the nearest strings to a vector, given a distance, a number of neighbors, and a distance type.

- enumerateNeighborsForString:maximumCount:maximumDistance:distanceType:usingBlock:

Enumerates the nearest neighbors of a string, given a closure, a distance, a number of neighbors, and a distance type.

- enumerateNeighborsForVector:maximumCount:distanceType:usingBlock:

Enumerates the nearest strings of a vector, given a closure, a number of neighbors, and a distance type.

- enumerateNeighborsForVector:maximumCount:maximumDistance:distanceType:usingBlock:

Enumerates the nearest strings of a vector, given a closure, a distance, a number of neighbors, and a distance type.