in hypernymysuite/base.py [0:0]
def __init__(self, precomputed):
self.vocab = {"<OOV>": 0}
self.lookup = {}
with open(precomputed) as f:
for line in f:
w1, w2, sim, is_oov = line.strip().split("\t")
if w1 == "hypo" and w2 == "hyper":
# header, ignore it
continue
if is_oov == "1" or is_oov.lower() in ("t", "true"):
# Don't read in oov predictions
continue
if w1 not in self.vocab:
self.vocab[w1] = len(self.vocab)
if w2 not in self.vocab:
self.vocab[w2] = len(self.vocab)
sim = float(sim)
self.lookup[(self.vocab[w1], self.vocab[w2])] = sim