finished correlation plots and generic voice plots

This commit is contained in:
2026-02-03 01:59:26 +01:00
parent 2408d06098
commit 190e4fbdc4
2 changed files with 145 additions and 0 deletions

View File

@@ -1825,3 +1825,18 @@ def split_consumer_groups(df: Union[pl.LazyFrame, pl.DataFrame], col: str = "Con
groups[group] = df_clean.filter(pl.col(group_col_alias) == group)
return groups
# Filter SPEAKING_STYLES to only include traits containing any keyword
def filter_speaking_styles(speaking_styles: dict, keywords: list[str]) -> dict:
"""Filter speaking styles to only include traits matching any keyword."""
filtered = {}
for color, traits in speaking_styles.items():
matching_traits = [
trait for trait in traits
if any(kw.lower() in trait.lower() for kw in keywords)
]
if matching_traits:
filtered[color] = matching_traits
return filtered