Unity
  • NatML for Unity
  • Preliminaries
    • Getting Started
    • Requirements
  • Workflows
    • Core Concepts
    • Fetching Models
    • Using Predictors
  • Authoring
    • Creating Predictors
    • Distributing Predictors
  • API Reference
    • IMLPredictor
    • MLModel
      • MLEdgeModel
        • Configuration
      • MLCloudModel
    • MLFeature
      • MLArrayFeature
      • MLImageFeature
      • MLStringFeature
      • MLAudioFeature
      • MLVideoFeature
      • MLDepthFeature
      • MLXRCpuDepthFeature
    • MLFeatureType
      • MLArrayType
      • MLAudioType
      • MLImageType
      • MLVideoType
      • MLStringType
    • MLPredictorExtensions
  • Integrations
    • Media Devices
    • Augmented Reality
    • Video Recording
  • Insiders
    • Changelog
    • Open Source
    • GitHub
    • Discord
    • Blog
Powered by GitBook
On this page
  • Creating the Feature
  • From Plain Text
  • From a Cloud Feature
  • Inspecting the String
  • Type Conversions
  • Creating Cloud Features

Was this helpful?

  1. API Reference
  2. MLFeature

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.

PreviousMLImageFeatureNextMLAudioFeature

Last updated 2 years ago

Was this helpful?