finished correlation plots and generic voice plots
This commit is contained in:
15
utils.py
15
utils.py
@@ -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
|
||||
Reference in New Issue
Block a user