When there is only one sentence in the input, document[u'sentences'][u'sentence'] returns a OrderedDict instead of a list, thus causing a KeyError when trying to indexing through it.
This bug can fixed by simply putting raw_sent_list into a list when such case is present.
When there is only one sentence in the input,
document[u'sentences'][u'sentence']
returns a OrderedDict instead of a list, thus causing a KeyError when trying to indexing through it. This bug can fixed by simply puttingraw_sent_list
into a list when such case is present.