Text Classification
SkillfulAPI.
TextClassification
SkillfulAPI.
TextClassification
Overview
The TextClassification
function provides functionality to classify a given input text and determine its sentiment by analyzing positive and negative scores. This can be useful for various applications, including sentiment analysis and content moderation in games.
Class Definition
Detailed Explanation
Start Method
Description: Unity's Start
method is called when the script is first initialized. This method begins the text classification process.
Code:
Functionality:
Automatically calls the
ClassifyText
method when the script starts.This method is ideal for initializing processes or setting up necessary configurations when the script is first executed.
ClassifyText Method
Description: The ClassifyText
method sends a predefined input text to the SkillfulAI API for text classification and logs the classification results.
Code:
Functionality:
Sends the input text to the SkillfulAI API for classification.
Logs the positive and negative scores received from the API response.
Provides insights into the sentiment or tone of the input text.
Usage Example
Add the Script to a GameObject:
Attach the
TextClassification
script to any GameObject in your Unity scene.
Run the Scene:
Upon starting the scene, the
ClassifyText
method will be invoked automatically.The predefined input text will be sent to the SkillfulAI API, and the classification results will be logged to the console.
Conclusion
The TextClassification
function showcases a simple implementation of text classification using the SkillfulAI Gaming SDK. By analyzing the sentiment of text input, this class can be utilized to enhance user interaction, feedback, and content management in your Unity project.
Last updated