استعلامات عن مشاعر المجتمع والسمية

-- [params]
-- topic_id :topic_id

SELECT 
    cr.target_id as post_id,
    cr.model_used,
    cr.classification->'negative' as negative,
    cr.classification->'neutral' as neutral,
    cr.classification->'positive' as positive
FROM classification_results cr
  JOIN posts p ON p.id = cr.target_id
WHERE cr.model_used = 'sentiment'
  AND p.topic_id = :topic_id
ORDER BY p.id

آه، لقد سبقتني. :slight_smile:

ولكن إليك واحد لمنشور معين أيضًا فقط حتى لا تشعر بأنها ردود غير مجدية:

-- [params]
-- topic_id :topic_id
-- int :post_number

SELECT 
    cr.target_id as post_id,
    cr.model_used,
    cr.classification->'negative' as negative,
    cr.classification->'neutral' as neutral,
    cr.classification->'positive' as positive
FROM classification_results cr
  JOIN posts p ON p.id = cr.target_id
WHERE cr.model_used = 'sentiment'
  AND p.topic_id = :topic_id
  AND p.post_number = :post_number

يمكن العثور على topic_id و post_number في عنوان URL، لذا فهو سهل الاستخدام للغاية.

Topic_id:

Post_number:

5 إعجابات