MCPcopy Create free account
hub / github.com/google-research/language / resplit_data

Function resplit_data

language/orqa/preprocessing/create_data_splits.py:41–50  ·  view source on GitHub ↗

Resplit a dataset of jsonlines with QA pairs.

(input_path, output_path, keep_fn)

Source from the content-addressed store, hash-verified

39
40
41def resplit_data(input_path, output_path, keep_fn):
42 """Resplit a dataset of jsonlines with QA pairs."""
43 count = 0
44 with tf.io.gfile.GFile(output_path, "w") as output_file:
45 for line in tf.io.gfile.GFile(input_path):
46 example = json.loads(line)
47 if keep_fn(example["question"]):
48 output_file.write(line)
49 count += 1
50 tf.logging.info("Wrote {} examples to {}".format(count, output_path))
51
52
53def resplit_nq():

Callers 3

resplit_nqFunction · 0.85
resplit_wbFunction · 0.85
resplit_ctFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…