21fd621eb03fb948c1f48ec4a81821c1025d5739,gb/sense/disambiguation.py,Disambiguation,words_similarity,#Disambiguation#Any#Any#Any#,87
Before Change
if (word1.text not in exclude) or (word2.text not in exclude):
pair_id1 = "%s %s" % (word1.text, word2.text)
pair_id2 = "%s %s" % (word2.text, word1.text)
if pair_id1 in self.cache:
local_score = self.cache[pair_id1]
elif pair_id2 in self.cache:
local_score = self.cache[pair_id2]
else:
sim = word1.similarity(word2)
prob1 = math.exp(word1.prob)
prob2 = math.exp(word2.prob)
local_score = 0.
if sim > SIMILARITY_THRESHOLD:
local_score = 1. / (prob1 * prob2 * sim)
self.cache[pair_id1] = local_score
score += local_score
count += 1
if 0 < MAX_COUNT <= count:
logging.debug("words similarity computed [interrupted: MAX_COUNT] (count: %s)" % count)
After Change
return score
logging.debug("words similarity computed (count: %s)" % count)
self.words_similarity_t += time.time() - start
return score
def best_sense(self, roots, aux_text, namespaces=None):
start = time.time()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: graphbrain/graphbrain
Commit Name: 21fd621eb03fb948c1f48ec4a81821c1025d5739
Time: 2017-05-22
Author: telmo@telmomenezes.net
File Name: gb/sense/disambiguation.py
Class Name: Disambiguation
Method Name: words_similarity
Project Name: facebookresearch/ParlAI
Commit Name: 63be4f29ef4c2d13658515ef87682fa428b23704
Time: 2019-01-15
Author: roller@fb.com
File Name: parlai/scripts/train_model.py
Class Name: TrainLoop
Method Name: log
Project Name: eth-cscs/reframe
Commit Name: 0f1c2a98960c6e3ba8d48e4f00ad358ccb204f07
Time: 2020-09-15
Author: karakasis@cscs.ch
File Name: reframe/core/schedulers/pbs.py
Class Name: PbsJobScheduler
Method Name: _poll_job