a871536bcbb38b9ca03b0bc777712d8c0a79ad90,matchzoo/data_pack/pack.py,,pack,#Any#,17

Before Change


        col_all.append("label")

    // prepare data pack.
    df = pd.DataFrame(data, columns=col_all)
    df.fillna("missing")  // avoid tokenization exception.

    // Segment input into 3 dataframes.
    relation = df[col_relation]

After Change


        3     L-2         C      R-2          c      0

    
    if "text_left" not in df or "text_right" not in df:
        raise ValueError(
            "Input data frame must have `text_left` and `text_right`.")

    // Gather IDs
    if "id_left" not in df:
        id_left = _gen_ids(df, "text_left", "L-")
    else:
        id_left = df["id_left"]
    if "id_right" not in df:
        id_right = _gen_ids(df, "text_right", "R-")
    else:
        id_right = df["id_right"]

    // Build Relation
    relation = pd.DataFrame(data={"id_left": id_left, "id_right": id_right})
    for col in df:
        if col not in ["id_left", "id_right", "text_left", "text_right"]:
            relation[col] = df[col]

    // Build Left and Right
    left = _merge(df, id_left, "text_left", "id_left")
    right = _merge(df, id_right, "text_right", "id_right")
    return matchzoo.DataPack(relation, left, right)


def _merge(data, ids, text_label, id_label):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: NTMC-Community/MatchZoo
Commit Name: a871536bcbb38b9ca03b0bc777712d8c0a79ad90
Time: 2018-12-13
Author: i@uduse.com
File Name: matchzoo/data_pack/pack.py
Class Name:
Method Name: pack


Project Name: dmbee/seglearn
Commit Name: f15e6db393d3ed6ddca47669ac5a8c4b332ddd2c
Time: 2020-03-31
Author: david.mo.burns@gmail.com
File Name: examples/plot_nn_training_curves.py
Class Name:
Method Name:


Project Name: daavoo/pyntcloud
Commit Name: 55c52a191bb36313c86ea340a024f4fe21eac699
Time: 2016-10-17
Author: daviddelaiglesiacastro@gmail.com
File Name: pyntcloud/pyntcloud.py
Class Name: PyntCloud
Method Name: __init__