Creates a word tagger from a training set in a data table.
- macOS 10.14+
- Xcode 10.0+
- Create ML
The tokens and their labels contained in an
The name of the column containing the tokens.
The name of the column containing the labels for the tokens.
The model parameters to use when creating the word tagger.
You use this initializer to create a word tagger when your training data are in an
MLData. Typically, you’d create a data table by importing a JSON or CSV file, but you can also build a data table programmatically.
As an example, start with a JSON file that contains a sequence of objects at its root. Each object in that root sequence contains:
A sequence of token strings
A sequence of label strings, one for each token
Alternatively, start with a CSV file that has at least two columns: one for tokens and one for labels. Each entry in the
token column must be an array of token strings. Each corresponding entry in the
label column must be an array of label strings. The lengths of these two arrays must be the same, because the elements of one array correspond to the other. For example, the first token string,
"the", corresponds to the first label string,
"article", and so on.
Import the JSON or CSV file into a data table by passing the file’s URL to the initializer.
Create the word tagger by passing in the data table to its initializer.