<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NaturalLanguage",
  "identifier" : "/documentation/NaturalLanguage/NLEmbedding/neighborsForVector:maximumCount:maximumDistance:distanceType:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Natural Language"
    ],
    "preciseIdentifier" : "c:objc(cs)NLEmbedding(im)neighborsForVector:maximumCount:maximumDistance:distanceType:"
  },
  "title" : "neighborsForVector:maximumCount:maximumDistance:distanceType:"
}
-->

# neighborsForVector:maximumCount:maximumDistance:distanceType:

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

```
- (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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)