def parse_test_instance(story): """Returns TWO ParsedStory instances representing option 1 and 2""" # this is very compressed id = story.InputStoryid story = list(story) sentences = [chains.nlp(sentence) for sentence in story[2:6]] alternatives = [story[6], story[7]] return [chains.ParsedStory(id, id, chains.nlp(" ".join(story[2:6]+[a])), *(sentences+[chains.nlp(a)])) for a in alternatives]
def to_story(story, id): return [chains.ParsedStory(id, id, chains.nlp(story)), *[]]