def p_builder(worker, sentence, use_lower):
        data = concatenate(sentence=sentence, use_lower=use_lower)

        data_with_name = data \
            .apply_flow(NameExtractionOneWayFlow(), as_worker=False)

        data = concatenate(sentence=data_with_name.get('names'),
                           use_lower2=use_lower)
        return data
예제 #2
0
    def p_builder_general(worker, sentence, use_lower):
        data = concatenate(sentence=sentence, use_lower=use_lower)

        v1 = data.subscribe_pipeline(p_builder)\
                 .subscribe_flow(NameExtractionFlowMultiple(use_lower=use_lower))
        v2 = data.subscribe_pipeline(p_builder)\
                 .subscribe_flow(NameExtractionFlowMultiple(use_lower=use_lower))

        return concatenate(v1=v1, v2=v2).subscribe_func(t.save_one_item)
예제 #3
0
    def p_builder(worker, sentence, use_lower):
        data = concatenate(sentence=sentence, use_lower=use_lower)

        data_with_name = data\
            .subscribe_flow(NameExtractionOneWayFlow())

        return data_with_name
    def p_builder(worker, sentence):
        root_branch = sentence \
            .subscribe_func(lambda sentence: dict(func1="ok"), name='root1') \
            .subscribe_func(lambda sentence: dict(func2="ok"), name='root2')

        branch_1 = root_branch \
            .add_value(name='branch_1') \
            .subscribe_func(lambda func1, func2: dict(func1_1="ok"),
                            name='branch_1_1') \
            .subscribe_func(lambda func1, func2: dict(result="branch_1"),
                            name='branch_1_2')\
            .subscribe_consumer(save_globaly)

        branch_2 = root_branch \
            .add_value(name='branch_2') \
            .subscribe_func(lambda func1, func2: dict(func1_1="ok"),
                            name='branch_2_1') \
            .subscribe_func(lambda func1, func2: dict(result="branch_2"),
                            name='branch_2_2')\
            .subscribe_consumer(save_globaly)

        branch_3 = root_branch \
            .add_value(name='branch_3') \
            .subscribe_func(lambda func1, func2: dict(func1_1="ok"),
                            name='branch_3_1') \
            .subscribe_func(lambda func1, func2: dict(result="branch_3"),
                            name='branch_3_2')\
            .subscribe_consumer(save_globaly)

        return concatenate(branch_1=branch_1,
                           branch_2=branch_2,
                           branch_3=branch_3)
예제 #5
0
    def p_builder(worker, sentence):
        root_branch = sentence \
            .subscribe_func(lambda sentence: dict(func1="ok"), name='root1') \
            .subscribe_func(lambda sentence: dict(func2="ok"), name='root2')

        return concatenate(branch_1=root_branch.subscribe_pipeline(branch_1),
                           branch_2=root_branch.subscribe_pipeline(branch_2),
                           branch_3=root_branch.subscribe_pipeline(branch_3))
    def p_builder(worker, sentence, use_lower):
        data = concatenate(sentence=sentence, use_lower=use_lower)

        data_with_name = data\
            .subscribe_flow(NameExtractionOneWayFlow(), as_worker=False)\
            .apply_flow(NameExtractionFlowMultiple(), as_worker=False)

        return data_with_name
    def p_builder(worker, sentence):
        branch_1 = sentence \
            .subscribe_func(lambda sentence: dict(s2="ok"), name='s2') \
            .subscribe_func_as_producer(lambda sentence: [dict(s3="ok")], name='s3') \
            .apply_func(lambda sentence: dict(asd="applied"))

        return concatenate(sentence=sentence, result=branch_1) \
            .subscribe_consumer(save_globaly)
예제 #8
0
 def branch_2(work, func1, func2):
     root_branch = concatenate(func1=func1, func2=func2)
     return root_branch \
         .add_value(name='branch_2') \
         .subscribe_func(lambda func1, func2: dict(func1_1="ok"),
                         name='branch_2_1') \
         .subscribe_func(lambda func1, func2: dict(result="branch_2"),
                         name='branch_2_2')\
         .subscribe_consumer(save_globaly)
예제 #9
0
    def p_builder_general(worker, sentence, use_lower):
        data = concatenate(sentence=sentence, use_lower=use_lower)

        return data.subscribe_pipeline(p_builder)\
                   .subscribe_flow(NameExtractionFlowMultiple(),
                                   as_worker=False)