<!--
{
  "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/NLTokenUnit/word",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "Natural Language"
    ],
    "preciseIdentifier" : "c:@E@NLTokenUnit@NLTokenUnitWord"
  },
  "title" : "NLTokenUnit.word"
}
-->

# NLTokenUnit.word

An individual word.

```
case word
```

## Discussion

Use this linguistic unit to tokenize text into individual words, like in the following example:

```swift
let text = "This is a sentence containing several words. 😀"

let tokenizer = NLTokenizer(unit: .word)
tokenizer.string = text

let range = text.startIndex..<text.endIndex

let tokenArray = tokenizer.tokens(for: range)
print("Number of tokens: \(tokenArray.count)")

tokenizer.enumerateTokens(in: range) { tokenRange, _ in
    print(text[tokenRange])
    return true
}
```

For more information, see [Tokenizing natural language text](/documentation/NaturalLanguage/tokenizing-natural-language-text).

---

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)