def convert_fce(fce_dir):
    """Processes the whole FCE directory. Yields annotated documents (strings)."""

    # Ensure we got the valid dataset path
    if not os.path.isdir(fce_dir):
        raise UserWarning(
            f"{fce_dir} is not a valid path")

    dataset_dir = os.path.join(fce_dir, 'dataset')
    if not os.path.exists(dataset_dir):
        raise UserWarning(
            f"{fce_dir} doesn't point to a dataset's root dir")

    # Convert XML docs to the corpora format
    filenames = sorted(glob.glob(os.path.join(dataset_dir, '*/*.xml')))

    docs = []
    for filename in filenames:
        with open(filename, encoding='utf-8') as f:
            doc = annotate_fce_doc(f.read())
            docs.append(doc)
    return docs
Processes the whole FCE directory. Yields annotated documents (strings).
utils/prepare_clc_fce_data.py