diff --git a/corenlp/corenlp.py b/corenlp/corenlp.py index f2c9a16..65284f7 100644 --- a/corenlp/corenlp.py +++ b/corenlp/corenlp.py @@ -222,8 +222,10 @@ def extract_words_from_xml(sent_node): # Making a raw sentence list of dictionaries: raw_sent_list = document[u'sentences'][u'sentence'] + if type(raw_sent_list) != list: + raw_sent_list = [raw_sent_list] + # Convert sentences to the format like python - # TODO: If there is only one sentence in input sentence, # raw_sent_list is dict and cannot decode following code... sentences = [{'dependencies': [[dep['dep'][i]['@type'], dep['dep'][i]['governor']['#text'],