def add_conditional_gateway_branch(phases_list: List, order, suffix, condition: SvoConstruct, action: SvoConstruct): if condition.get_participant( ) is not None and not condition.get_participant().is_pronoun(): phases_list.append({ Consts.order_prop: str(order) + suffix + "1", Consts.activity_prop: create_activity_from_svo(action), Consts.condition_prop: utils.svo_full_name(condition), Consts.who_prop: utils.participant_full_name(condition.get_participant()), Consts.subprocess_prop: "", Consts.terminated_prop: "" }) else: phases_list.append({ Consts.order_prop: str(order) + suffix + "1", Consts.activity_prop: create_activity_from_svo(action), Consts.condition_prop: utils.svo_full_name(condition), Consts.who_prop: "", Consts.subprocess_prop: "", Consts.terminated_prop: "" })
def test_example_phrase_six(self): filepath = "../examples/example_phrase_six" nlp = spacy.load("en") text = open(filepath).read().replace("\n", " ") doc = nlp(text) svos = [] for sentence in doc.sents: utils.to_nltk_tree(sentence.root).pretty_print() participants, svos = extract.extract_process_elements(sentence) for svo in svos: print(utils.svo_full_name(svo)) self.assertEqual(len(svos), 1, "SVO list length is incorrect")