MLStringFeature

class NatML.Features.MLStringFeature : 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 a string feature.
/// </summary>
/// <param name="text">Text.</param>
MLStringFeature (string text);

The string feature can be created from a string.

From a Cloud Feature

/// <summary>
/// Create a string feature from a cloud feature.
/// </summary>
/// <param name="feature">Cloud feature. This MUST be an `string` feature.</param>
MLStringFeature (MLCloudFeature feature);

A string 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 MLStringFeature(outputFeatures[0]);

The cloud feature MUST be a string feature.

Inspecting the String

/// <summary>
/// Feature text.
/// </summary>
string text { get; }

The string feature exposes the enclosing text that it was created with.

Type Conversions

/// <summary>
/// Get the `string` contained in the string feature.
/// </summary>
static implicit operator string (MLStringFeature 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 (MLFeatureType featureType);

INCOMPLETE.

Last updated