20d1da406aaa2ae2a32c48a28e3efe4f475d7398,ch12/libbots/subtitles.py,,phrase_pairs_dict,#Any#,181

Before Change


    :param phrase_pairs: list of (phrase, phrase) pairs
    :return: set
    
    res = set()
    for p1, p2 in phrase_pairs:
        res |= set(map(str.lower, p1.words)) | set(map(str.lower, p2.words))
    return res


def dialogues_to_pairs(dialogues, max_tokens=None):

After Change


    next_id = 0
    res = {}
    for p1, p2 in phrase_pairs:
        for w in map(str.lower, itertools.chain(p1.words, p2.words)):
            if w not in res:
                res[w] = next_id
                next_id += 1
    return res


def dialogues_to_pairs(dialogues, max_tokens=None):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 20d1da406aaa2ae2a32c48a28e3efe4f475d7398
Time: 2018-01-06
Author: max.lapan@gmail.com
File Name: ch12/libbots/subtitles.py
Class Name:
Method Name: phrase_pairs_dict


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 20d1da406aaa2ae2a32c48a28e3efe4f475d7398
Time: 2018-01-06
Author: max.lapan@gmail.com
File Name: ch12/libbots/subtitles.py
Class Name:
Method Name: phrase_pairs_dict


Project Name: ericmjl/pyjanitor
Commit Name: b5dca485575de7052f2ce8f39ea845e848e1ac89
Time: 2020-12-09
Author: samueloranyeli@gmail.com
File Name: janitor/functions.py
Class Name:
Method Name: fill_direction


Project Name: dit/dit
Commit Name: 3181b06a66ee5a2185f637e4072cc8e24d0801ec
Time: 2015-03-05
Author: chebee7i@gmail.com
File Name: dit/validate.py
Class Name:
Method Name: validate_outcomes


Project Name: Calamari-OCR/calamari
Commit Name: 8e94ba8539d13e570d65522a59114ce41a7189ec
Time: 2018-05-28
Author: wick.chr.info@gmail.com
File Name: calamari_ocr/ocr/voting/confidence_voter.py
Class Name:
Method Name: perform_conf_vote