90e5b974a7173ab0bba0990a690e32f25f5b725a,tools/embeddings_to_torch.py,,get_vocabs,#Any#,13

Before Change


        if vocab[0] == "src":
            enc_vocab = vocab[1]
        if vocab[0] == "tgt":
            dec_vocab = vocab[1]
    assert enc_vocab is not None and dec_vocab is not None

    logger.info("From: %s" % dict_file)
    logger.info("\t* source vocab: %d words" % len(enc_vocab))

After Change



    if old_style_vocab(fields):
        enc_vocab = next((v for n, v in fields if n == "src"), None)
        dec_vocab = next((v for n, v in fields if n == "tgt"), None)
    else:
        enc_vocab = fields["src"][0][1].vocab
        dec_vocab = fields["tgt"][0][1].vocab

    logger.info("From: %s" % dict_path)
    logger.info("\t* source vocab: %d words" % len(enc_vocab))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: 90e5b974a7173ab0bba0990a690e32f25f5b725a
Time: 2019-01-14
Author: benzurdopeters@gmail.com
File Name: tools/embeddings_to_torch.py
Class Name:
Method Name: get_vocabs


Project Name: google/deepvariant
Commit Name: 9423dc741a1da8ffbee5d9b7ae6a49d00d3ed151
Time: 2019-06-13
Author: sidharthgoel@google.com
File Name: deepvariant/vcf_stats.py
Class Name:
Method Name: _get_variant_type


Project Name: OpenNMT/OpenNMT-py
Commit Name: 1802cda9ee0d03354daf790f847345f8dd515555
Time: 2017-06-22
Author: digangi@fbk.eu
File Name: onmt/Models.py
Class Name: NMTModel
Method Name: forward