# core/normalizers/vocabulary.normalizer.ts

> 8 lines of code and 2 definitions.

Tree: GovLab Context
Language: typescript
Layer: processing
Canonical: https://banes-lab.com/anatomy/context#file-context-core-normalizers-vocabulary-normalizer-ts
Source text: https://banes-lab.com/source/context/core/normalizers/vocabulary.normalizer.ts.txt

Listed in [core/normalizers](https://banes-lab.com/api/source/context/core/normalizers.md), after [core/normalizers/reason.surface.normalizer.ts](https://banes-lab.com/source/context/core/normalizers/reason.surface.normalizer.ts.md).

## Definitions

- `canonicalForceOf` (lexical_declaration, line 3, exported)
- `folded` (lexical_declaration, line 4, exported)

## Contained in

- [core/normalizers](https://banes-lab.com/anatomy/context/folder-context-core-normalizers.md)

## Source

```typescript
import { CANONICAL_FORCES, FORCE_JOINER, SPELLING_GAPS } from "#configuration/constants/vocabulary.constants";

export const canonicalForceOf = function canonicalForceOf(token: string): string | null {
    let folded = "";
    for (const char of token.trim().toLowerCase()) {
        folded += SPELLING_GAPS.has(char) ? FORCE_JOINER : char;
    }
    return folded !== token && CANONICAL_FORCES.has(folded) ? folded : null;
};
```
