Léim go dtí an príomhábhar
Gaeilge— Roghnaigh teanga
Roghchlár

Anailís Mothúchán ar X

Ceacht 9 as 12 Nuashonraithe 30 Iúil 2026 Meánleibhéal
Ar an leathanach seo
  1. Tuiscint a fháil ar bhreithiúnas do lucht éisteachta
  2. Toisí mothúcháin sa mhargaíocht
  3. Anailís a dhéanamh ar mhothúchán le Cuardach X agus Grok
  4. Torthaí struchtúrtha a fháil i JSON
  5. Éabhlóid an mhothúcháin a rianú le himeacht ama
  6. Géarchéimeanna cáile a bhrath
  7. Príomhphointí

Tuiscint a fháil ar bhreithiúnas do lucht éisteachta

Tiontaíonn an anailís mothúchán na mílte post léamh soiléir ar an gcaoi a bhfeictear do bhranda, do chuid iomaitheoirí, nó do thionscal. Le Cuardach X agus cumais réasúnaíochta Grok, is féidir leat dul thar aicmiú simplí dearfach/diúltach chun nuansaí mothúchánacha, frustrachais fholaigh, agus comharthaí rabhaidh a thuiscint.

5
leibhéil mothúcháin
API
fíor-am
JSON
aschur struchtúrtha
Il
toisí anailísithe

Toisí mothúcháin sa mhargaíocht

Téann anailís mothúchán sa mhargaíocht thar an déthóime dearfach/diúltach. Seo na toisí ábhartha:

Scála mothúcháin 5 leibhéal

  1. An-dearfach: díograis, moladh gníomhach, grá don bhranda
  2. Dearfach: sásamh, formheas, suim
  3. Neodrach: lua fíorasach, comhroinnt faisnéise
  4. Diúltach: díomá, cáineadh, frustrachas
  5. An-dhiúltach: fearg, glaoch ar bhuíocóid, géarchéim

Toisí breise

  • Rún ceannaigh: An léiríonn an post rún ceannach nó díliostála?
  • Tionchar: An dtagann an post ó chuntas tionchair nó ó thomhaltóir meánach?
  • Víreasacht: An bhfuil acmhainn leathana ag an bpost?
  • Práinn: An éilíonn an comhartha freagairt thapa?

Anailís a dhéanamh ar mhothúchán le Cuardach X agus Grok

Anailís mothúcháin do do bhranda

def analyser_sentiment_marque(marque, periode_jours=7):
    from datetime import datetime, timedelta

    today = datetime.now().strftime("%Y-%m-%d")
    start = (datetime.now() - timedelta(days=periode_jours)).strftime("%Y-%m-%d")

    response = client.responses.create(
        model="grok-4.20-0309-reasoning",
        input=f"""Analyze the sentiment of conversations on X
        about {marque} between {start} and {today}.

        For each conversation theme identified, provide:
        1. The theme (e.g., "customer service", "product quality")
        2. The dominant sentiment (1-5 scale)
        3. The estimated conversation volume
        4. The most representative verbatims
        5. The most influential accounts in the discussion
        6. Sentiment evolution over the period

        Final summary:
        - Global sentiment score (1-5)
        - Top 3 positive points
        - Top 3 negative points
        - Any alerts""",
        tools=[{
            "type": "x_search",
            "from_date": start,
            "to_date": today
        }]
    )
    return response.output_text

Anailís chomparáideach mothúcháin

Déan comparáid idir an chaoi a bhfeictear do bhranda agus do chuid iomaitheoirí:

def sentiment_comparatif(marques, periode_jours=30):
    from datetime import datetime, timedelta

    today = datetime.now().strftime("%Y-%m-%d")
    start = (datetime.now() - timedelta(days=periode_jours)).strftime("%Y-%m-%d")

    response = client.responses.create(
        model="grok-4.20-0309-reasoning",
        input=f"""Compare sentiment on X for these brands:
        {', '.join(marques)}

        Period: {start} to {today}

        For each brand, evaluate:
        - Global sentiment score (1-5, with decimal)
        - Dominant positive themes
        - Dominant negative themes
        - Strengths perceived by the public
        - Weaknesses perceived by the public

        Final comparison table ranked by sentiment.
        Identify positioning opportunities for the
        first brand in the list.""",
        tools=[{"type": "x_search", "from_date": start, "to_date": today}]
    )
    return response.output_text

Torthaí struchtúrtha a fháil i JSON

Chun an anailís mothúcháin a chomhtháthú i bpíblíne sonraí, iarr aschur JSON:

def sentiment_structure(marque, periode_jours=7):
    from datetime import datetime, timedelta

    today = datetime.now().strftime("%Y-%m-%d")
    start = (datetime.now() - timedelta(days=periode_jours)).strftime("%Y-%m-%d")

    response = client.responses.create(
        model="grok-4.20-0309-reasoning",
        input=f"""Analyze sentiment on X about {marque}.
        Period: {start} to {today}.

        Respond ONLY in valid JSON with this structure:
        {{
          "brand": "{marque}",
          "period": "{start} - {today}",
          "global_score": 3.7,
          "distribution": {{
            "very_positive": 15,
            "positive": 35,
            "neutral": 30,
            "negative": 15,
            "very_negative": 5
          }},
          "themes": [
            {{
              "name": "customer service",
              "score": 2.1,
              "volume": "high",
              "trend": "stable"
            }}
          ],
          "alerts": ["alert description if applicable"],
          "recommendations": ["recommended action"]
        }}""",
        tools=[{"type": "x_search", "from_date": start, "to_date": today}]
    )
    return response.output_text

Éabhlóid an mhothúcháin a rianú le himeacht ama

Tá anailís aonuaire úsáideach, ach nochtann rianú le himeacht ama treochtaí. Déan comparáid idir torthaí seachtain i ndiaidh seachtaine:

def evolution_sentiment(marque, nb_semaines=4):
    from datetime import datetime, timedelta
    import json

    historique = []
    for i in range(nb_semaines, 0, -1):
        end = (datetime.now() - timedelta(weeks=i-1)).strftime("%Y-%m-%d")
        start = (datetime.now() - timedelta(weeks=i)).strftime("%Y-%m-%d")

        response = client.responses.create(
            model="grok-4.20-0309-reasoning",
            input=f"""Sentiment score on X for {marque}
            from {start} to {end}.
            Respond with a JSON: {{"week": "{start}",
            "score": X.X, "volume": N, "dominant_theme": "..."}}""",
            tools=[{
                "type": "x_search",
                "from_date": start,
                "to_date": end
            }]
        )
        historique.append(response.output_text)

    return historique

Géarchéimeanna cáile a bhrath

Is é an anailís mothúcháin do chéad chóras aláraim i gcás géarchéime:

def detecter_crise(marque, seuil_negatif=40):
    resultat = sentiment_structure(marque, periode_jours=1)

    # Parse the JSON
    import json
    data = json.loads(resultat)

    pct_negatif = (data["distribution"]["negative"] +
                   data["distribution"]["very_negative"])

    if pct_negatif > seuil_negatif:
        return {
            "alert": True,
            "level": "CRITICAL" if pct_negatif > 60 else "IMPORTANT",
            "score": data["global_score"],
            "negative_themes": [t for t in data["themes"] if t["score"] < 2.5],
            "recommendation": "Crisis meeting recommended"
        }
    return {"alert": False, "score": data["global_score"]}

Príomhphointí

  • Téann an anailís mothúchán thar dearfach/diúltach: déan meastóireacht ar rún, ar thionchar agus ar phráinn
  • Úsáid scála 5 leibhéal chun nuansaí a ghabháil
  • Iarr aschuir JSON struchtúrtha chun do dheaisphainéil a bheathú
  • Rianaigh éabhlóid an mhothúcháin le himeacht ama, ní hamháin grianghraif aonuaire
  • Déan comparáid chórasach idir do mhothúchán agus mothúchán do chuid iomaitheoirí
  • Cumraigh tairseacha aláraim chun géarchéimeanna cáile a bhrath de réir mar a thagann siad chun cinn