empty spans and spans with no 'text' attribute

Ah, sorry! Completely forgot. You get this if you have a record that can't find a spans.

Change to this (I've also updated the code above):

    for eg in examples:
        if eg.get('spans') is not None:
            for span in eg.get('spans'):
                span['text'] = eg['text'][span['start']:span['end']]

By using eg.get('spans') instead of eg["spans"] you won't get an error when it doesn't find a key.

Crossing fingers that this should work :crossed_fingers: