def to_spacy_dataset(text, entities):
    """
    TRAIN_DATA = [
        (
            "<text>",
            {
                "entities": [
                (<start>, <end>, <label), 
                (<start>, <end>, <label), 
                ...
                ]
            }
        ),
        ...
    ]
    """

    entities_reformat = []
    for entity in entities:
        start = entity.get("begin_offset")
        end = start + entity.get("length")
        label = entity.get("type")

        entities_reformat.append((start, end, label))
    
    train_data = (
        text,
        {
            "entities": entities_reformat
        }
    )


    return train_data