def part_path(id, dir, set, part): return join_path(dir, set, 'book_%s.%s' % (id, part))
def load_id(id, dir): path = join_path(dir, '%s.txt.iob' % id) lines = load_lines(path) return parse_conll(lines)
def list_ids(dir, set): for filename in list_dir(join_path(dir, set)): match = re.match(r'^book_(\d+)\.txt$', filename) if match: yield match.group(1)
def ann_path(id, dir): return join_path(dir, '%s.ann' % id)
def txt_path(id, dir): return join_path(dir, '%s.txt' % id)
def objects_path(id, dir, set): return join_path(dir, set, 'book_%s.objects' % id)
def spans_path(id, dir, set): return join_path(dir, set, 'book_%s.spans' % id)
def txt_path(id, dir, set): return join_path(dir, set, 'book_%s.txt' % id)