<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NaturalLanguage",
  "identifier" : "/documentation/NaturalLanguage/NLDistanceType/cosine",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "Natural Language"
    ],
    "preciseIdentifier" : "c:@E@NLDistanceType@NLDistanceTypeCosine"
  },
  "title" : "NLDistanceType.cosine"
}
-->

# NLDistanceType.cosine

A method of calculating distance by using cosine similarity.

```
case cosine
```

## Discussion

The range of a cosine distance is `[0.0, 2.0]`, derived from the expression `1 -` *cosine similarity*.

---

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)