Wordseer / stanford-corenlp-python

Python wrapper for Stanford CoreNLP tools
GNU General Public License v2.0
58 stars 27 forks source link

fix xml parsing issue when there is only one sentence in the result #13

Open dnc1994 opened 8 years ago

dnc1994 commented 8 years ago

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.