RAP Logo
Blocks ReferenceMulti modal

NLP Classifier

Classify text using Natural Language Processing (NLP) techniques.

NLP Classifier Block

The NLP Classifier block is designed for text classification using Natural Language Processing (NLP) techniques. It allows you to categorize text inputs into predefined classes or labels based on their content.

Overview

This block is useful for tasks such as sentiment analysis, spam detection, topic labeling, and intent recognition in conversational AI.

Configuration Options

Choose Algorithm

Select the NLP classification algorithm to use:

  • Sentiment Analysis: Classify text as positive, negative, or neutral.
  • Topic Modeling: Assign one or more topics to the input text.
  • Custom Model: Use a custom-trained NLP model for specific classification tasks.

Input

  • msg.payload.text: The input text string to be classified.
  • msg.payload.model_id: (Required for Custom Model) The ID of the custom NLP classification model to use.

Output

  • msg.payload.classification: The predicted class or category of the text.
  • msg.payload.confidence: The confidence score of the classification.
  • msg.payload.labels: (For Topic Modeling) An array of identified topics.

Example Usage

{
  "payload": {
    "text": "The service was excellent and the staff was very friendly.",
    "algorithm": "Sentiment Analysis"
  }
}

Tips

  • Ensure the input text is clean and relevant to the classification task.
  • For custom models, ensure your training data is diverse and representative of the categories you want to classify.
  • Evaluate the confidence score to determine the reliability of the classification.