utils4text.py
def build_concise_convs_df(df_convs, njobs = mp.cpu_count()):
    """
    Using the functions, build_convs and apply_parallel, a dataframe with conversation sets
    can be easily built. Also the id for each conversation is added.

    Arg:
        df_convs: The original dataframe consisting of posts and comments parsed from the text files.
    Return:
        df_convs_concise: The concise version of a dataframe with conversation sets.
    """
    df_convs_concise = apply_parallel(df_convs.groupby(df_convs.link_id), build_convs)
    df_convs_concise['conversation id'] = (df_convs_concise.groupby(['post title']).cumcount() == 0).astype(int)
    df_convs_concise['conversation id'] = df_convs_concise['conversation id'].cumsum()
    df_convs_concise = df_convs_concise[['conversation id', 'subreddit', 'post title', 'author', 'dialog turn', 'text']]
    df_convs_concise = df_convs_concise.reset_index().drop('index', axis = 1)
    return df_convs_concise

    Using the functions, build_convs and apply_parallel, a dataframe with conversation sets
    can be easily built. Also the id for each conversation is added.

    Arg:
        df_convs: The original dataframe consisting of posts and comments parsed from the text files.
    Return:
        df_convs_concise: The concise version of a dataframe with conversation sets.
    
Using the functions, build_convs and apply_parallel, a dataframe with conversation sets
can be easily built. Also the id for each conversation is added.

The original dataframe consisting of posts and comments parsed from the text files.
Return:
df_convs_concise: The concise version of a dataframe with conversation sets.
Using the functions build_convs and apply_parallel a dataframe with conversation sets can be easily built . Also the id for each conversation is added . The original dataframe consisting of posts and comments parsed from the text files . Return : df_convs_concise : The concise version of a dataframe with conversation sets .
def build_concise_convs_df(df_convs, njobs = mp.cpu_count()):
    df_convs_concise = apply_parallel(df_convs.groupby(df_convs.link_id), build_convs)
    df_convs_concise['conversation id'] = (df_convs_concise.groupby(['post title']).cumcount() == 0).astype(int)
    df_convs_concise['conversation id'] = df_convs_concise['conversation id'].cumsum()
    df_convs_concise = df_convs_concise[['conversation id', 'subreddit', 'post title', 'author', 'dialog turn', 'text']]
    df_convs_concise = df_convs_concise.reset_index().drop('index', axis = 1)
    return df_convs_concise
def build_concise_convs_df ( df_convs , njobs = mp . cpu_count ( ) ) : df_convs_concise = apply_parallel ( df_convs . groupby ( df_convs . link_id ) , build_convs ) df_convs_concise [ 'conversation id' ] = ( df_convs_concise . groupby ( [ 'post title' ] ) . cumcount ( ) == 0 ) . astype ( int ) df_convs_concise [ 'conversation id' ] = df_convs_concise [ 'conversation id' ] . cumsum ( ) df_convs_concise = df_convs_concise [ [ 'conversation id' , 'subreddit' , 'post title' , 'author' , 'dialog turn' , 'text' ] ] df_convs_concise = df_convs_concise . reset_index ( ) . drop ( 'index' , axis = 1 ) return df_convs_concise
Using the functions, build_convs and apply_parallel, a dataframe with conversation sets
can be easily built.
Using the functions build_convs and apply_parallel a dataframe with conversation sets can be easily built .
"""
    Using the functions, build_convs and apply_parallel, a dataframe with conversation sets
    can be easily built. Also the id for each conversation is added.

    Arg:
        df_convs: The original dataframe consisting of posts and comments parsed from the text files.
    Return:
        df_convs_concise: The concise version of a dataframe with conversation sets.
    """
df_convs
njobs