utils4text.py
def count_speaker_profanity(df):
    """
    Compute the number of profane words spoken by the speakers.

    Arg:
        df: A dataframe containing profane utterances.
    Return:
        len(df_speaker_toxic): the length of the dataframe of profanity from speakers.
    """
    # extract speakers' turn
    df_speaker = df[df['dialog turn'] == 1]

    # extract toxic turn
    df_speaker_toxic = apply_parallel(df_speaker.groupby(df_speaker['conversation id']), extract_profanity)

    return len(df_speaker_toxic)

    Compute the number of profane words spoken by the speakers.

    Arg:
        df: A dataframe containing profane utterances.
    Return:
        len(df_speaker_toxic): the length of the dataframe of profanity from speakers.
    
Compute the number of profane words spoken by the speakers.
Arg:
df: A dataframe containing profane utterances.
Return:
len(df_speaker_toxic): the length of the dataframe of profanity from speakers.
Compute the number of profane words spoken by the speakers . Arg : df : A dataframe containing profane utterances . Return : len ( df_speaker_toxic ) : the length of the dataframe of profanity from speakers .
def count_speaker_profanity(df):
    df_speaker = df[df['dialog turn'] == 1]
    df_speaker_toxic = apply_parallel(df_speaker.groupby(df_speaker['conversation id']), extract_profanity)
    return len(df_speaker_toxic)
def count_speaker_profanity ( df ) : df_speaker = df [ df [ 'dialog turn' ] == 1 ] df_speaker_toxic = apply_parallel ( df_speaker . groupby ( df_speaker [ 'conversation id' ] ) , extract_profanity ) return len ( df_speaker_toxic )
Compute the number of profane words spoken by the speakers.
Compute the number of profane words spoken by the speakers .
"""
    Compute the number of profane words spoken by the speakers.

    Arg:
        df: A dataframe containing profane utterances.
    Return:
        len(df_speaker_toxic): the length of the dataframe of profanity from speakers.
    """ # extract speakers' turn # extract toxic turn
df