Zero Shot Classification
SkillfulAPI.ZeroShotTextClassification
SkillfulAPI.ZeroShotTextClassificationOverview
Class Definition
using SkillfulAI.API;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ZeroShotClassification : MonoBehaviour
{
/// <summary>
/// Unity's Start method, called when the script is initialized. Initiates the text classification process.
/// </summary>
void Start()
{
ClassifyText();
}
/// <summary>
/// Performs zero-shot text classification using predefined context labels.
/// </summary>
public void ClassifyText()
{
// Predefined context labels for classification
string[] context = new string[] {
"new customer",
"refund",
"legal"
};
// Perform zero-shot text classification on a sample input text
SkillfulAPI.ZeroShotTextClassification("Hi I need to rent a new car for my holiday.", context, result =>
{
// Log each classification result
foreach (var classification in result.classifications)
{
Debug.Log(classification.Label + " : " + classification.Score);
}
});
}
}Detailed Explanation
Usage Example
Conclusion
Last updated