enwiki / materialize.py
jph00's picture
Replace enwiki dataset with cleaned md articles and chunk indexes
dd2931a verified
Raw History Blame
239 Bytes
"Reconstruct chunk text from the two dataset configurations."
def materialize(article, chunk):
body = article["md"].encode()
start = chunk["start_byte"]
return chunk["prefix_md"] + body[start:start+chunk["byte_len"]].decode()