---
title: NLTokenUnit.word
framework: naturallanguage
role: symbol
role_heading: Case
path: naturallanguage/nltokenunit/word
---

# NLTokenUnit.word

An individual word.

## Declaration

```swift
case word
```

## Mentioned in

Tokenizing natural language text

## Discussion

Discussion Use this linguistic unit to tokenize text into individual words, like in the following example: 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.

## See Also

### Constants

- [NLTokenUnit.sentence](naturallanguage/nltokenunit/sentence.md)
- [NLTokenUnit.paragraph](naturallanguage/nltokenunit/paragraph.md)
- [NLTokenUnit.document](naturallanguage/nltokenunit/document.md)
