4b674552c6755a5b154927b0cf86aa4812729ec4,examples/most_common_word_sense/prepare_data.py,,read_gs_file,#Any#,40

Before Change


        hypernym_vec1    (list(str)): words hypernyms vector
        label_vec1       (list(str)): labels of binary class 0/1
    
    file = codecs.open(gs_file_name, "rU", "utf-8")
    reader = csv.reader((line.replace("\0", "") for line in file))

    cntr1 = 0
    // 1. read csv file
    target_word_vec1 = []
    definition_vec1 = []
    hypernym_vec1 = []

    label_vec1 = []

    header_line_flag = True
    for line in reader:
        if line is not None:
            if header_line_flag:  // skip header line
                header_line_flag = False
                continue

            target_word_vec1.insert(cntr1, line[0].strip())
            definition_vec1.insert(cntr1, line[1])
            hypernym_vec1.insert(cntr1, line[2])
            label_vec1.insert(cntr1, line[3])
            cntr1 = cntr1 + 1

    file.close()

    return target_word_vec1, definition_vec1, hypernym_vec1, label_vec1

After Change


        hypernym_vec1    (list(str)): words hypernyms vector
        label_vec1       (list(str)): labels of binary class 0/1
    
    with open(gs_file_name, "rU", encoding="utf-8") as file:
        reader = csv.reader((line.replace("\0", "") for line in file))

        cntr1 = 0
        // 1. read csv file
        target_word_vec1 = []
        definition_vec1 = []
        hypernym_vec1 = []

        label_vec1 = []

        header_line_flag = True
        for line in reader:
            if line is not None:
                if header_line_flag:  // skip header line
                    header_line_flag = False
                    continue

                target_word_vec1.insert(cntr1, line[0].strip())
                definition_vec1.insert(cntr1, line[1])
                hypernym_vec1.insert(cntr1, line[2])
                label_vec1.insert(cntr1, line[3])
                cntr1 = cntr1 + 1

    return target_word_vec1, definition_vec1, hypernym_vec1, label_vec1


// -------------------------------------------------------------------------------------//
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 6

Non-data size: 6

Instances


Project Name: NervanaSystems/nlp-architect
Commit Name: 4b674552c6755a5b154927b0cf86aa4812729ec4
Time: 2018-05-14
Author: daniel.korat@intel.com
File Name: examples/most_common_word_sense/prepare_data.py
Class Name:
Method Name: read_gs_file


Project Name: keras-team/keras
Commit Name: 4cde148de0c37981c50f3a8e4a59fa4e5f653e17
Time: 2018-02-04
Author: bohumir.zamecnik@gmail.com
File Name: examples/pretrained_word_embeddings.py
Class Name:
Method Name:


Project Name: NervanaSystems/nlp-architect
Commit Name: 3b27baf2719698ffe600ff3d33b10c04d2e39f33
Time: 2018-07-16
Author: jonathan.mamou@intel.com
File Name: solutions/set_expansion/prepare_data.py
Class Name:
Method Name:


Project Name: deepmipt/DeepPavlov
Commit Name: 8261994bf8f77251f0b22fb13fa490ffa0bd184b
Time: 2018-02-01
Author: yoptar@gmail.com
File Name: deeppavlov/core/data/utils.py
Class Name:
Method Name: ungzip


Project Name: hanxiao/bert-as-service
Commit Name: fafc6c60d9534f2036af61a1f3ead9e81070762f
Time: 2019-01-22
Author: hanhxiao@tencent.com
File Name: server/bert_serving/server/benchmark.py
Class Name:
Method Name: run_benchmark


Project Name: NervanaSystems/nlp-architect
Commit Name: 4d8cca40654deb641809bf8fb376afd9b1633d52
Time: 2019-03-31
Author: daniel.korat@intel.com
File Name: nlp_architect/data/ptb.py
Class Name: PTBDictionary
Method Name: _uncompress_data