API reference
API reference
Select your platform
No SDKs available
No versions available

WitFloatValue Class

Extends WitValue
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

Tolerance for floating-point equality comparisons. Two floats are considered equal if their absolute difference is less than this value. Default is 0.0001.

Member Functions

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