A custom model trained to classify or tag natural language text.


class NLModel : NSObject


With Create ML, you can create MLTextClassifier or MLWordTagger models. Use the NLModel to integrate those models into your app. This integration ensures that your tokenization and tagger configurations are identical when you train your model and use it in your app.


Creating a Model

init(mlModel: MLModel)

Creates a new natural language model based on the given Core ML model instance.

init(contentsOf: URL)

Creates a new natural language model based on a compiled Core ML model at the given URL.

Making Predictions

func predictedLabel(for: String) -> String?

Predicts a label for the given input string.

func predictedLabels(forTokens: [String]) -> [String]

Predicts a label for each string in the given array.

Inspecting a Model

var configuration: NLModelConfiguration

A configuration describing the natural language model.

class NLModelConfiguration

The configuration parameters of a natural language model.


Inherits From

Conforms To

See Also