DocumentationNeurondB Documentation

Text ML

Text Classification

Categorize text into predefined classes using trained classification models.

Classify text

WITH text_samples AS (
    SELECT 'This product is amazing! Best purchase ever.' as text, 1 as sample_id
    UNION ALL
    SELECT 'Terrible experience, would not recommend.' as text, 2 as sample_id
)
SELECT 
    sample_id,
    text,
    neurondb.text_classify(
        text,
        'sentiment_classifier'  -- Model name
    ) as category
FROM text_samples;

Sentiment Analysis

Detect positive, negative, or neutral sentiment in text with confidence scores.

Analyze sentiment

WITH reviews AS (
    SELECT 'I love this product! It exceeded all my expectations.' as review, 1 as review_id
    UNION ALL
    SELECT 'This is the worst purchase I have ever made.' as review, 2 as review_id
)
SELECT 
    review_id,
    review,
    neurondb.sentiment_analyze(
        review,
        'sentiment_model'
    ) as sentiment
FROM reviews;

Named Entity Recognition

Extract named entities (people, organizations, locations) from text.

Extract entities

SELECT neurondb.extract_entities(
    'Apple Inc. is located in Cupertino, California.',
    'ner_model'
) as entities;

Next Steps