---
title: "enumerateNeighborsForVector:maximumCount:distanceType:usingBlock:"
framework: naturallanguage
role: symbol
role_heading: Instance Method
path: "naturallanguage/nlembedding/enumerateneighborsforvector:maximumcount:distancetype:usingblock:"
---

# enumerateNeighborsForVector:maximumCount:distanceType:usingBlock:

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

## Declaration

```occ
- (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:

## See Also

### Finding strings and their distances in an embedding

- [neighborsForString:maximumCount:distanceType:](naturallanguage/nlembedding/neighborsforstring:maximumcount:distancetype:.md)
- [neighborsForString:maximumCount:maximumDistance:distanceType:](naturallanguage/nlembedding/neighborsforstring:maximumcount:maximumdistance:distancetype:.md)
- [neighborsForVector:maximumCount:distanceType:](naturallanguage/nlembedding/neighborsforvector:maximumcount:distancetype:.md)
- [neighborsForVector:maximumCount:maximumDistance:distanceType:](naturallanguage/nlembedding/neighborsforvector:maximumcount:maximumdistance:distancetype:.md)
- [enumerateNeighborsForString:maximumCount:distanceType:usingBlock:](naturallanguage/nlembedding/enumerateneighborsforstring:maximumcount:distancetype:usingblock:.md)
- [enumerateNeighborsForString:maximumCount:maximumDistance:distanceType:usingBlock:](naturallanguage/nlembedding/enumerateneighborsforstring:maximumcount:maximumdistance:distancetype:usingblock:.md)
- [enumerateNeighborsForVector:maximumCount:maximumDistance:distanceType:usingBlock:](naturallanguage/nlembedding/enumerateneighborsforvector:maximumcount:maximumdistance:distancetype:usingblock:.md)
- [distanceBetweenString:andString:distanceType:](naturallanguage/nlembedding/distancebetweenstring:andstring:distancetype:.md)
- [NLDistance](naturallanguage/nldistance.md)
