MCPcopy Create free account
hub / github.com/apache/singa / get_label2answer

Function get_label2answer

examples/qabot/qabot_data.py:48–58  ·  view source on GitHub ↗
(data_dir)

Source from the content-addressed store, hash-verified

46
47
48def get_label2answer(data_dir):
49 import gzip
50 label2answer = dict()
51 with gzip.open(data_dir +
52 "/InsuranceQA.label2answer.token.encoded.gz") as fin:
53 for line in fin:
54 pair = line.decode().strip().split("\t")
55 idxs = pair[1].split(" ")
56 idxs = [int(idx.replace("idx_", "")) for idx in idxs]
57 label2answer[int(pair[0])] = idxs
58 return label2answer
59
60
61pad_idx = 0

Callers 1

prepare_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected