<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 10.14.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLTextClassifier/DataSource",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML16MLTextClassifierV10DataSourceO"
  },
  "title" : "MLTextClassifier.DataSource"
}
-->

# MLTextClassifier.DataSource

A data source for a text classifier.

```
enum DataSource
```

## Topics

### Creating a data source

[`case labeledDirectories(at: URL)`](/documentation/CreateML/MLTextClassifier/DataSource/labeledDirectories(at:))

A root directory of labeled directories for your data set.

### Retrieving the data

[`func labeledTexts() throws -> [String : [String]]`](/documentation/CreateML/MLTextClassifier/DataSource/labeledTexts())

Fetches the labeled data from the data source.

[`func stratifiedSplit(proportions: [Double], seed: Int, labelColumn: String, textColumn: String) throws -> MLDataTable`](/documentation/CreateML/MLTextClassifier/DataSource/stratifiedSplit(proportions:seed:labelColumn:textColumn:))

Generates a data table by splitting the data source into strata.



---

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)