6e5ac39b4247082efdf934e0e03cc234ddcef529,src/gensim/corpora/dmlcorpus.py,DmlCorpus,loadDictionary,#Any#,176

Before Change


    @staticmethod
    def loadDictionary(fname):
        words = [line.split("\t")[1].strip() for line in open(fname) if len(line.split("\t")) == 2]
        id2word = dict(itertools.izip(xrange(len(words)), words))
        return id2word
    
    def saveDocuments(self, fname):
        logging.info("saving documents mapping to %s" % fname)

After Change


    @staticmethod
    def loadDictionary(fname):
        result = {}
        for lineNo, line in enumerate(open(fname)):
            pair = line[:-1].split("\t")
            if len(pair) != 2:
                continue
            wordId, word = pair
            result[int(wordId)] = word
        return result
    
    def saveDocuments(self, fname):
        logging.info("saving documents mapping to %s" % fname)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: RaRe-Technologies/gensim
Commit Name: 6e5ac39b4247082efdf934e0e03cc234ddcef529
Time: 2010-04-02
Author: piskvorky@92d0401f-a546-4972-9173-107b360ed7e5
File Name: src/gensim/corpora/dmlcorpus.py
Class Name: DmlCorpus
Method Name: loadDictionary


Project Name: scipy/scipy
Commit Name: 1af61eee76fc63e98ba5ad85ad82fbd18111b8e9
Time: 2014-01-28
Author: joel.nothman@gmail.com
File Name: scipy/sparse/data.py
Class Name: _minmax_mixin
Method Name: _min_or_max_axis


Project Name: RaRe-Technologies/gensim
Commit Name: aaa0d4fcdff881ccbd69d4be0e370ac55b930f10
Time: 2010-04-02
Author: radimrehurek@seznam.cz
File Name: src/gensim/corpora/dmlcorpus.py
Class Name: DmlCorpus
Method Name: loadDictionary