Zero Shot Classification
SkillfulAPI.
ZeroShotTextClassification
SkillfulAPI.
ZeroShotTextClassification
Overview
The ZeroShotTextClassification
function provides functionality for classifying text into predefined context labels without needing explicit training on those labels. This can be useful for categorizing text into different contexts or topics based on the given labels.
Class Definition
Detailed Explanation
Start Method
Description: Unity's Start
method is called when the script is first initialized. This method triggers the text classification process.
Code:
Functionality:
Automatically invokes the
ClassifyText
method when the script starts.Ideal for initiating classification tasks or performing actions as soon as the script is activated.
ClassifyText Method
Description: The ClassifyText
method performs zero-shot text classification using predefined context labels and logs the classification results.
Code:
Functionality:
Uses predefined context labels to classify the input text.
Processes the input text ("Hi I need to rent a new car for my holiday.") to determine which context it fits best.
Logs the classification results, including the label and score for each context.
Usage Example
Add the Script to a GameObject:
Attach the
ZeroShotClassification
script to any GameObject in your Unity scene.
Run the Scene:
Upon starting the scene, the
ClassifyText
method will be invoked automatically.The specified input text will be classified according to the predefined labels, and the results will be logged to the console.
Conclusion
The ZeroShotTextClassification
function provides a straightforward implementation of zero-shot text classification using the SkillfulAI Gaming SDK. By classifying text into predefined context labels, you can efficiently categorize and interpret textual data in your Unity project.
Last updated