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
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):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
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: 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
Project Name: bokeh/bokeh
Commit Name: 5f6b5d3851d0b719f401eafbfc569420405d1ef3
Time: 2016-08-16
Author: canavandl@gmail.com
File Name: bokeh/models/formatters.py
Class Name: FuncTickFormatter
Method Name: from_py_func