// 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 toleranceequalityTolerance
: 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 |
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 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 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 Returns override object
The extracted float value as an object
|