<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Speech",
  "identifier" : "/documentation/Speech/SFCustomLanguageModelData",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Speech"
    ],
    "preciseIdentifier" : "s:6Speech25SFCustomLanguageModelDataC"
  },
  "title" : "SFCustomLanguageModelData"
}
-->

# SFCustomLanguageModelData

An object that generates and exports custom language model training data.

```
class SFCustomLanguageModelData
```

## Topics

### Creating a model data container

[`init(locale:identifier:version:builder:)`](/documentation/Speech/SFCustomLanguageModelData/init(locale:identifier:version:builder:))

Constructs a data container using a builder

[`init(locale:identifier:version:)`](/documentation/Speech/SFCustomLanguageModelData/init(locale:identifier:version:))

Constructs an empty data container.

[`DataInsertableBuilder`](/documentation/Speech/SFCustomLanguageModelData/DataInsertableBuilder)

A custom parameter attribute that constructs custom language model data from closures.

### Adding terms

[`insert(term:)`](/documentation/Speech/SFCustomLanguageModelData/insert(term:))

Add a custom term to the vocabulary.

[`supportedPhonemes(locale:)`](/documentation/Speech/SFCustomLanguageModelData/supportedPhonemes(locale:))

List the supported subset of X-SAMPA pronunciations supported by this locale for the Speech framework.

[`CustomPronunciation`](/documentation/Speech/SFCustomLanguageModelData/CustomPronunciation)

A term to be introduced into the speech recognition model’s vocabulary.

### Adding phrases

[`insert(phraseCount:)`](/documentation/Speech/SFCustomLanguageModelData/insert(phraseCount:))

Add a sample to the body of training data.

[`PhraseCount`](/documentation/Speech/SFCustomLanguageModelData/PhraseCount)

A phrase used to bias the language model, along with a weight influencing the relative strength of the bias.

### Adding parameterized sample data within a result builder

[`PhraseCountsFromTemplates`](/documentation/Speech/SFCustomLanguageModelData/PhraseCountsFromTemplates)

A type that can be used to construct custom language model data by specifying a set of template classes and using the
result builder DSL to specify templates.

[`TemplateInsertableBuilder`](/documentation/Speech/SFCustomLanguageModelData/TemplateInsertableBuilder)

A custom parameter attribute that constructs custom language model data from closures.

### Adding parameterized sample data with a generator

[`insert(phraseCountGenerator:)`](/documentation/Speech/SFCustomLanguageModelData/insert(phraseCountGenerator:))

Add a stream of samples to the body of training data.

[`TemplatePhraseCountGenerator`](/documentation/Speech/SFCustomLanguageModelData/TemplatePhraseCountGenerator)

A `PhraseCountGenerator` that produces `PhraseCount` values based on templates.

[`PhraseCountGenerator`](/documentation/Speech/SFCustomLanguageModelData/PhraseCountGenerator)

Abstract base class defining the interface for classes that generate `PhraseCount` via an iterator.

### Exporting model data

[`export(to:)`](/documentation/Speech/SFCustomLanguageModelData/export(to:))

Export the accumulated data to a file.

### Inspecting model data

[`identifier`](/documentation/Speech/SFCustomLanguageModelData/identifier)

[`locale`](/documentation/Speech/SFCustomLanguageModelData/locale)

[`version`](/documentation/Speech/SFCustomLanguageModelData/version)

### Result builder support

[`CompoundTemplate`](/documentation/Speech/SFCustomLanguageModelData/CompoundTemplate)

A class supporting the custom language model training data result builder. You are not intended to use this directly.

[`DataInsertable`](/documentation/Speech/DataInsertable)

A protocol supporting the custom language model training data result builder.

[`TemplateInsertable`](/documentation/Speech/TemplateInsertable)

A protocol supporting the custom language model training data result builder.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`Encodable`](/documentation/Swift/Encodable)

[`Decodable`](/documentation/Swift/Decodable)

[`Equatable`](/documentation/Swift/Equatable)

---

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)