NatML
Search…
MLTextFeature
class NatSuite.ML.Features.MLTextFeature : MLFeature, IMLCloudFeature
This feature contains plain text. It is intended for use with natural language processing (NLP) models.

Creating the Feature

From Plain Text

1
/// <summary>
2
/// Create the text feature.
3
/// </summary>
4
/// <param name="text">Text.</param>
5
MLTextFeature (string text);
Copied!
The text feature can be created from a string.

From a Cloud Feature

1
/// <summary>
2
/// Create the text feature from a Cloud feature.
3
/// </summary>
4
/// <param name="feature">Cloud feature. This MUST be an `STRING` feature.</param>
5
MLTextFeature (MLCloudFeature feature);
Copied!
A text feature can be created from a Cloud feature. This constructor is useful for working with output prediction data from an MLCloudModel when authoring a predictor:
1
// Make a Cloud prediction
2
MLCloudModel model = ...;
3
MLCloudFeature[] outputFeatures = model.Predict(...);
4
// Create a text feature from a Cloud string feature
5
var feature = new MLTextFeature(outputFeatures[0]);
Copied!
The Cloud feature MUST be a STRING feature.

Inspecting the Text

1
/// <summary>
2
/// Feature text.
3
/// </summary>
4
string text { get; }
Copied!
The text feature exposes the enclosing text that it was created with.

Type Conversions

1
/// <summary>
2
/// Get the `string` contained in the text feature.
3
/// </summary>
4
static implicit operator string (MLTextFeature feature);
Copied!
The feature type provides an implicit conversion to the string text which it contains.

Creating Cloud Features

1
/// <summary>
2
/// Create a Cloud ML feature that is ready for prediction with Cloud ML models.
3
/// </summary>
4
/// <param name="featureType">Optional feature type used to create the Cloud ML feature.</param>
5
/// <returns>Cloud ML feature.</returns>
6
MLCloudFeature IMLCloudFeature.Create (in MLFeatureType featureType = default);
Copied!
INCOMPLETE.