NatML
Search…
MLTextFeature
class NatML.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

/// <summary>
/// Create the text feature.
/// </summary>
/// <param name="text">Text.</param>
MLTextFeature (string text);
The text feature can be created from a string.

From a Cloud Feature

/// <summary>
/// Create the text feature from a Cloud feature.
/// </summary>
/// <param name="feature">Cloud feature. This MUST be an `STRING` feature.</param>
MLTextFeature (MLCloudFeature feature);
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:
// Make a Cloud prediction
MLCloudModel model = ...;
MLCloudFeature[] outputFeatures = model.Predict(...);
// Create a text feature from a Cloud string feature
var feature = new MLTextFeature(outputFeatures[0]);
The Cloud feature MUST be a STRING feature.

Inspecting the Text

/// <summary>
/// Feature text.
/// </summary>
string text { get; }
The text feature exposes the enclosing text that it was created with.

Type Conversions

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

Creating Cloud Features

/// <summary>
/// Create a Cloud ML feature that is ready for prediction with Cloud ML models.
/// </summary>
/// <param name="featureType">Optional feature type used to create the Cloud ML feature.</param>
/// <returns>Cloud ML feature.</returns>
MLCloudFeature IMLCloudFeature.Create (in MLFeatureType featureType = default);
INCOMPLETE.
Copy link
On this page
Creating the Feature
From Plain Text
From a Cloud Feature
Inspecting the Text
Type Conversions
Creating Cloud Features