speaking style trait scores
This commit is contained in:
@@ -73,7 +73,6 @@ def _(check_progress, data_all, duration_validation, mo):
|
||||
|
||||
|
||||
{duration_validation(data_all)}
|
||||
|
||||
""")
|
||||
return
|
||||
|
||||
@@ -263,23 +262,14 @@ def _(mo, plot_most_ranked_1, top3_voices):
|
||||
def _(mo):
|
||||
mo.md(r"""
|
||||
## Voice Speaking Style - Perception Traits
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md(r"""
|
||||
How does each voice score for each “speaking style labeled trait”? Here you can find the speaking styles and traits: [Speaking Style Traits Quantitative test design.docx](https://voicebranding-my.sharepoint.com/:w:/g/personal/phoebe_voicebranding_ai/IQBfM_Z8PF98Qalz4lzIbJ3RAUCdc7waB32HZXCj7k3xfo0?e=rtFd27)
|
||||
|
||||
- There are 4 speaking styles: Green, Blue, Orange, Red.
|
||||
- There are 16 traits distributed across the 4 speaking styles.
|
||||
Here you can find the speaking styles and traits: [Speaking Style Traits Quantitative test design.docx](https://voicebranding-my.sharepoint.com/:w:/g/personal/phoebe_voicebranding_ai/IQBfM_Z8PF98Qalz4lzIbJ3RAUCdc7waB32HZXCj7k3xfo0?e=rtFd27)
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(data, survey):
|
||||
def _(data, survey, utl):
|
||||
ss_or, choice_map_or = survey.get_ss_orange_red(data)
|
||||
ss_gb, choice_map_gb = survey.get_ss_green_blue(data)
|
||||
|
||||
@@ -289,43 +279,26 @@ def _(data, survey):
|
||||
|
||||
choice_map = {**choice_map_or, **choice_map_gb}
|
||||
# print(_d.head())
|
||||
print(choice_map)
|
||||
return choice_map, ss_all
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(choice_map, ss_all, utl):
|
||||
# print(choice_map)
|
||||
ss_long = utl.process_speaking_style_data(ss_all, choice_map)
|
||||
ss_long
|
||||
return (ss_long,)
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(pl, ss_long):
|
||||
target_trait = "Indifferent | Unfocussed | Detached:Attentive | Helpful | Caring | Deliberate"
|
||||
trait_data = ss_long.filter(pl.col("Description") == target_trait)
|
||||
trait_data
|
||||
return target_trait, trait_data
|
||||
def _(mo, pl, plts, ss_long):
|
||||
content = """### How does each voice score for each “speaking style labeled trait”?"""
|
||||
|
||||
for i, trait in enumerate(ss_long.select("Description").unique().to_series().to_list()):
|
||||
trait_d = ss_long.filter(pl.col("Description") == trait)
|
||||
|
||||
@app.cell
|
||||
def _(plts, target_trait, trait_data):
|
||||
plts.plot_speaking_style_trait_scores(
|
||||
trait_data,
|
||||
title=target_trait.replace(":", " ↔ "),
|
||||
# trait_description="Attentive vs Indifferent", # simplified title
|
||||
)
|
||||
return
|
||||
content += f"""
|
||||
### {i+1}) {trait.replace(":", " ↔ ")}
|
||||
|
||||
|
||||
app._unparsable_cell(
|
||||
{mo.ui.plotly(plts.plot_speaking_style_trait_scores(trait_d, title=trait.replace(":", " ↔ "), height=550))}
|
||||
"""
|
||||
for trait in ss_long.select(\"Description\").unique().to_series().to_list():
|
||||
trait_data = ss_long.filter(pl.col(\"Description\") == trait)
|
||||
mo.md(f\"\"\"
|
||||
""",
|
||||
name="_"
|
||||
)
|
||||
|
||||
mo.md(content)
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
@@ -343,21 +316,13 @@ def _(data, mo, plot_average_scores_with_counts, survey):
|
||||
|
||||
mo.md(f"""
|
||||
|
||||
How does each voice score on a scale from 1-10?
|
||||
### How does each voice score on a scale from 1-10?
|
||||
|
||||
{mo.ui.plotly(plot_average_scores_with_counts(vscales, x_label='Voice', width=1000))}
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(mo):
|
||||
mo.md(r"""
|
||||
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md(r"""
|
||||
|
||||
35
plots.py
35
plots.py
@@ -768,7 +768,7 @@ def plot_speaking_style_trait_scores(
|
||||
pl.col("score").mean().alias("mean_score"),
|
||||
pl.col("score").count().alias("count")
|
||||
])
|
||||
.sort("mean_score", descending=True) # Descending for Left-to-Right
|
||||
.sort("mean_score", descending=False) # Ascending for display bottom-to-top
|
||||
)
|
||||
|
||||
# Attempt to extract anchors from DF if not provided
|
||||
@@ -795,33 +795,36 @@ def plot_speaking_style_trait_scores(
|
||||
fig = go.Figure()
|
||||
|
||||
fig.add_trace(go.Bar(
|
||||
x=stats["Voice"], # X is Voice
|
||||
y=stats["mean_score"], # Y is Score
|
||||
y=stats["Voice"], # Y is Voice
|
||||
x=stats["mean_score"], # X is Score
|
||||
orientation='h',
|
||||
text=stats["count"],
|
||||
textposition='inside',
|
||||
textangle=0,
|
||||
textfont=dict(size=16, color='white'),
|
||||
texttemplate='%{text}', # Count on bar
|
||||
marker_color=ColorPalette.PRIMARY,
|
||||
hovertemplate='<b>%{x}</b><br>Average: %{y:.2f}<br>Count: %{text}<extra></extra>'
|
||||
hovertemplate='<b>%{y}</b><br>Average: %{x:.2f}<br>Count: %{text}<extra></extra>'
|
||||
))
|
||||
|
||||
# Add annotations for anchors
|
||||
annotations = []
|
||||
|
||||
# Place anchors on the right side
|
||||
# Place anchors at the bottom
|
||||
if left_anchor:
|
||||
annotations.append(dict(
|
||||
xref='paper', yref='y',
|
||||
x=1.01, y=1,
|
||||
xanchor='left', yanchor='middle',
|
||||
xref='x', yref='paper',
|
||||
x=1, y=-0.2, # Below axis
|
||||
xanchor='left', yanchor='top',
|
||||
text=f"<b>1: {left_anchor.split('|')[0]}</b>",
|
||||
showarrow=False,
|
||||
font=dict(size=10, color='gray')
|
||||
))
|
||||
if right_anchor:
|
||||
annotations.append(dict(
|
||||
xref='paper', yref='y',
|
||||
x=1.01, y=5,
|
||||
xanchor='left', yanchor='middle',
|
||||
xref='x', yref='paper',
|
||||
x=5, y=-0.2, # Below axis
|
||||
xanchor='right', yanchor='top',
|
||||
text=f"<b>5: {right_anchor.split('|')[0]}</b>",
|
||||
showarrow=False,
|
||||
font=dict(size=10, color='gray')
|
||||
@@ -832,21 +835,21 @@ def plot_speaking_style_trait_scores(
|
||||
text=f"{title}<br><sub>{trait_description}</sub><br><sub>(Numbers on bars indicate respondent count)</sub>",
|
||||
y=0.92
|
||||
),
|
||||
xaxis_title="Voice",
|
||||
yaxis_title="Average Score (1-5)",
|
||||
xaxis_title="Average Score (1-5)",
|
||||
yaxis_title="Voice",
|
||||
height=height,
|
||||
width=width,
|
||||
plot_bgcolor=ColorPalette.BACKGROUND,
|
||||
yaxis=dict(
|
||||
xaxis=dict(
|
||||
range=[1, 5],
|
||||
showgrid=True,
|
||||
gridcolor=ColorPalette.GRID,
|
||||
zeroline=False
|
||||
),
|
||||
xaxis=dict(
|
||||
yaxis=dict(
|
||||
showgrid=False
|
||||
),
|
||||
margin=dict(r=150),
|
||||
margin=dict(b=120),
|
||||
annotations=annotations,
|
||||
font=dict(size=11)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user