f4275c0b80197e0f1bbd3a2a1a31cf07d85013b1,scripts/word_embeddings/evaluate_pretrained.py,,,#,173

Before Change



    // Load pre-trained embeddings
    if not args_.embedding_path:
        if args_.embedding_name.lower() == "fasttext":
            token_embedding_ = nlp.embedding.create(
                args_.embedding_name,
                source=args_.embedding_source,

After Change



    if args_.similarity_datasets:
        with utils.print_time("find relevant tokens for similarity"):
            tokens = evaluation.get_similarity_task_tokens(args_)
        vocab = nlp.Vocab(nlp.data.count_tokens(tokens))
        with utils.print_time("set {} embeddings".format(len(tokens))):
            vocab.set_embedding(token_embedding_)
        evaluation.evaluate_similarity(
            args_, vocab.embedding, ctx, logfile=os.path.join(
                args_.logdir, "similarity{}.tsv".format(name)))
    if args_.analogy_datasets:
        with utils.print_time("extend open vocabulary with "
                              "OOV tokens for analogy"):
            tokens = evaluation.get_analogy_task_tokens(args_)
            if token_embedding_.unknown_token is not None:
                tokens.update(token_embedding_.idx_to_token[1:])
            else:
                tokens.update(token_embedding_.idx_to_token)
        vocab = nlp.Vocab(nlp.data.count_tokens(tokens))
        with utils.print_time("set {} embeddings".format(len(tokens))):
            vocab.set_embedding(token_embedding_)
        evaluation.evaluate_analogy(
            args_, vocab.embedding, ctx, logfile=os.path.join(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: dmlc/gluon-nlp
Commit Name: f4275c0b80197e0f1bbd3a2a1a31cf07d85013b1
Time: 2019-01-09
Author: leonard@lausen.nl
File Name: scripts/word_embeddings/evaluate_pretrained.py
Class Name:
Method Name:


Project Name: streamlit/streamlit
Commit Name: 3e96b208fe5bc38223eb453b68a03dae51a33544
Time: 2018-10-22
Author: thiagot@gmail.com
File Name: lib/streamlit/caseconverters.py
Class Name:
Method Name: to_lower_camel_case


Project Name: deepmipt/DeepPavlov
Commit Name: cb0c025ab87216d35b68a2b4b36d61621acd76ba
Time: 2018-01-31
Author: arkhipov@yahoo.com
File Name: deeppavlov/models/ner/slotfill.py
Class Name: DstcSlotFillingNetwork
Method Name: infer