Files
Interview-Analysis/Sentiment_Research_Exploration.py
2025-11-26 18:47:20 +01:00

103 lines
3.2 KiB
Python

import marimo
__generated_with = "0.18.0"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
# Sentiment & Thematic Analysis of Interviews Using LLMs
## ✅ Step 1: Transcribe Audio Interviews
- Use a high-quality speech-to-text model:
- [OpenAI Whisper](https://github.com/openaihttps://azure.microsoft.com/en-us/services/cognitive-services/speech-to-text context
---
## ✅ Step 2: Preprocess Text
- Clean transcripts:
- Remove filler words
- Normalize punctuation
- Segment by:
- **Survey question triggers**
- **Brand character mentions**
---
## ✅ Step 3: Combine Survey Data
- Use survey responses as **metadata**:
- Link each interview segment to corresponding survey answers
- Helps LLM understand context (e.g., "This person rated Brand A as 'trustworthy' but said X in the interview")
---
## ✅ Step 4: Use LLM for Sentiment + Thematic Analysis
### **A. Sentiment Analysis**
- Define **custom sentiment dimensions** relevant to brand characters:
- Trustworthiness
- Friendliness
- Professionalism
- Authenticity
- Prompt the LLM with **few-shot examples**:
- Show examples of text and classification for each dimension
- Example output format:
```json
{
"brand_character": "Brand A",
"voice": "Friendly",
"sentiment": {
"trustworthiness": "positive",
"friendliness": "neutral",
"professionalism": "negative"
},
"key_quotes": ["I felt it was too casual for a serious brand."]
}
""")
return
@app.cell
def _(mo):
mo.md(r"""
# Findings from Foundational Research Report
## Brand character
### Brand tone (Foundation research delivery v1 for more details) (we need to provide the LLM with definitions of these attributes)
- Confident
- Progressive
- Clear
- Intentional
### Six CDA brand character personalities
- The bank teller: patient, grounded, down-to-earth, knowledgable, stable, steady, balanced, competent
- The familiar friend: warm, friendly, approachable, familiar, casual, appreciative, benevolent
- The coach: empowering, encouraging, caring, positive, optimistic, guiding, reassuring
- The personal assistant: proactive, progressive, cooperative, intentional, deliberate, resourceful, attentive adaptive
- The engineer: clear, modest, savvy, plainspoken, straight forward, direct, practical, transparent
- The counselor: confident, calm, reliable, dependable, respectable, reassuring, upright
### Personality model alternative dimensions (dimensions which were used to defined the six characters)
- Approachable: friendly, warm, welcoming
- Social-entertaining: humorous, playful, engaging
- Social-inclined: eager to converse, talkative, socially oriented
- Social assisting: supportive, empathetic, encouraging
- Self-conscious: cautious, modest, hesitant
- Artifical: robotic, mechanical, lacking human-like warmth
## Voice
""")
return
if __name__ == "__main__":
app.run()