API reference

WitFloatValue Class

ScriptableObject asset that extracts float values from Wit.ai JSON responses. Useful for confidence scores, numerical values, and other floating-point data. Supports configurable tolerance for equality comparisons.
Usage example:
// Create in Unity Editor or via script
var confidenceExtractor = ScriptableObject.CreateInstance<WitFloatValue>();
confidenceExtractor.path = "intents[0].confidence";
confidenceExtractor.equalityTolerance = 0.01f;

// Extract float value from response
var response = WitResponseNode.Parse("{\"intents\":[{\"confidence\":0.95}]}");
float confidence = confidenceExtractor.GetFloatValue(response);

// Compare with tolerance
bool isConfident = confidenceExtractor.Equals(response, 0.9f); // true within tolerance

Fields

equalityTolerance : float
Tolerance for floating-point equality comparisons. Two floats are considered equal if their absolute difference is less than this value. Default is 0.0001.
Signature
float Meta.WitAi.Data.WitFloatValue.equalityTolerance

Methods

Equals ( response , value )
Compares the float value in the response with a target value using the configured tolerance.
Signature
override bool Meta.WitAi.Data.WitFloatValue.Equals(WitResponseNode response, object value)
Parameters
response: WitResponseNode  The Wit.ai JSON response node
value: object  The value to compare (can be float, int, or parsable string)
Returns
override bool  True if values are within equalityTolerance of each other
GetFloatValue ( response )
Extracts the float value from the response at the configured path.
Signature
float Meta.WitAi.Data.WitFloatValue.GetFloatValue(WitResponseNode response)
Parameters
response: WitResponseNode  The Wit.ai JSON response node
Returns
float  The extracted float value
GetValue ( response )
Extracts the float value from the response at the configured path.
Signature
override object Meta.WitAi.Data.WitFloatValue.GetValue(WitResponseNode response)
Parameters
response: WitResponseNode  The Wit.ai JSON response node
Returns
override object  The extracted float value as an object