-- [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
Ah, tu m’as devancé. ![]()
Mais en voici une pour un post spécifique également, juste pour ne pas avoir l’impression d’une réponse inutile :
-- [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
Le topic_id et le post_number se trouvent tous deux dans l’URL, c’est donc assez convivial.
Topic_id:
Post_number: