Did I find the right examples for you? yes no

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
process the subsentence                                             
Input=sentence and verbal class         Output=sentence and verbal class         

        def process_subsentence(phrase, vg):
    """
    process the subsentence                                             
    Input=sentence and verbal class         Output=sentence and verbal class         
    """

    #init
    begin_pos = -1

    #If phrase is empty
    if len(phrase) < 0:
        return phrase

    #We look down the list to see if there is a subsentence
    for w in ResourcePool().subsentences:
        if w in phrase:

            begin_pos = phrase.index(w)

            #We include the relative's proposal if there are relatives in the subsentence
            end_pos = other_functions.recover_end_pos_sub(phrase[begin_pos:],
                                                          ResourcePool().subsentences + ResourcePool().relatives)

            #If it is 'where', it can be relative if before we have nominal group
            if w == 'where' or w == 'which':
                position = phrase.index(w) - 1

                gr = analyse_nominal_group.find_sn_pos(phrase, position)

                #We have to find the nominal group just before
                while position > 0 and gr == []:
                    position -= 1
                    gr = analyse_nominal_group.find_sn_pos(phrase, position)
                    #For exceptions, if the nominal group end with the proposal
                if gr != [] and gr[len(gr) - 1] == w:
                    gr = gr[:len(gr) - 1]

            #Else we return the sentence and we assume it as relative
            if (w != 'where' and w != 'which') or (
                        len(gr) + position != phrase.index(w) or (len(gr) == 1 and is_cmpl_pr(gr[0]) == 1)):
                #We have to remove the proposal
                subsentence = phrase[begin_pos + 1:begin_pos + end_pos]
                if len(subsentence) > 1:
                    subsentence = other_functions.recover_scd_verb_sub(subsentence)

                    if w != 'which':
                        #We perform processing
                        vg.vrb_sub_sentence = vg.vrb_sub_sentence + analyse_sentence.dispatching(subsentence)
                        vg.vrb_sub_sentence[len(vg.vrb_sub_sentence) - 1].data_type = SUBSENTENCE + '+' + \
                                                                                      vg.vrb_sub_sentence[len(
                                                                                          vg.vrb_sub_sentence) - 1].data_type
                        if w[0] == ':':
                            vg.vrb_sub_sentence[len(vg.vrb_sub_sentence) - 1].aim = w[1:]
                        else:
                            vg.vrb_sub_sentence[len(vg.vrb_sub_sentence) - 1].aim = w
                    else:
                        #Exception for which
                        vg.vrb_sub_sentence = vg.vrb_sub_sentence + [
                            analyse_sentence.w_quest_which(W_QUESTION, 'choice', ['the'] + subsentence)]
                        vg.vrb_sub_sentence[len(vg.vrb_sub_sentence) - 1].data_type = SUBSENTENCE + '+' + \
                                                                                      vg.vrb_sub_sentence[len(
                                                                                          vg.vrb_sub_sentence) - 1].data_type
                        vg.vrb_sub_sentence[len(vg.vrb_sub_sentence) - 1].aim = w

                    #If 'but' is between 2 nominal group and not before subsentence
                    if w == 'but':
                        #If the main verb is not a verb but a part of verbal structure => we have nominal groups
                        for k in ['.', '?', '!', ''] + ResourcePool().proposals:
                            if not vg.vrb_sub_sentence[len(vg.vrb_sub_sentence) - 1].sv \
                                or \
                                            vg.vrb_sub_sentence[len(vg.vrb_sub_sentence) - 1].sv[0].vrb_main[0] == k:
                                #We make changes and return the sentence with but of nominal groups
                                phrase[phrase.index(w)] = ':but'
                                vg.vrb_sub_sentence = vg.vrb_sub_sentence[:len(vg.vrb_sub_sentence) - 1]
                                return phrase

                    #We delete the subsentence
                    phrase = phrase[:begin_pos] + phrase[begin_pos + end_pos:] + ['.']
                    return phrase
    return phrase
        


src/d/i/Dialogs-0.13/src/dialogs/parsing/analyse_sentence.py   Dialogs(Download)
 
        #We recover the subsentence
        sentence = analyse_verbal_structure.process_subsentence(sentence, vg)
 
        #Process relative changes
 
    #We recover the subsentence
    sentence = analyse_verbal_structure.process_subsentence(sentence, vg)
 
    if sentence != [] and vg.vrb_main != []: