Esempio n. 1
0
def add_parallel_gateway_branch(phases_list, order, suffix,
                                action: SvoConstruct):
    if action.get_participant(
    ) is not None and not action.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:
            "",
            Consts.who_prop:
            utils.participant_full_name(action.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:
            "",
            Consts.who_prop:
            "",
            Consts.subprocess_prop:
            "",
            Consts.terminated_prop:
            ""
        })
Esempio n. 2
0
def add_sequence_flow(phases_list: List, order, action: SvoConstruct):
    if action.get_participant(
    ) is not None and not action.get_participant().is_pronoun():
        phases_list.append({
            Consts.order_prop:
            str(order),
            Consts.activity_prop:
            create_activity_from_svo(action),
            Consts.condition_prop:
            "",
            Consts.who_prop:
            utils.participant_full_name(action.get_participant()),
            Consts.subprocess_prop:
            "",
            Consts.terminated_prop:
            ""
        })
    else:
        phases_list.append({
            Consts.order_prop:
            str(order),
            Consts.activity_prop:
            create_activity_from_svo(action),
            Consts.condition_prop:
            "",
            Consts.who_prop:
            "",
            Consts.subprocess_prop:
            "",
            Consts.terminated_prop:
            ""
        })
Esempio n. 3
0
    def test_example_phrase_five(self):
        filepath = "../examples/example_phrase_five"
        nlp = spacy.load("en")

        text = open(filepath).read().replace("\n", " ")
        doc = nlp(text)

        participants = []
        for sentence in doc.sents:
            [
                utils.to_nltk_tree(sent.root).pretty_print()
                for sent in doc.sents
            ]
            participants, svos = extract.extract_process_elements(sentence)
            for participant in participants:
                print(utils.participant_full_name(participant))
        self.assertEqual(len(participants), 1,
                         "Participants list length is incorrect")