Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
finds the direct, indirect object and the adverbial                
We, also, put these information in the class                                     
Input=sentence and verbal class              Output=sentence and verbal class    

        def recover_obj_iobj(phrase, vg):
    """
    finds the direct, indirect object and the adverbial                
    We, also, put these information in the class                                     
    Input=sentence and verbal class              Output=sentence and verbal class    
    """

    #init
    conjunction = 'AND'

    object = analyse_nominal_group.find_sn(phrase)

    if phrase and \
            not object and \
                    phrase[0] in ResourcePool().adverbs_at_end:
        vg.advrb = [phrase[0]]

    while object:

        #If it is not a direct object => there is a proposal
        proposal = check_proposal(phrase, object)

        if proposal:

            gr_nom_list = []
            #This 'while' is for duplicate with 'and'
            while object:
                pos_object = phrase.index(object[0])

                #We refine the nominal group if there is an error like ending with question mark
                object = analyse_nominal_group.refine_nom_gr(object)

                #Recovering nominal group
                gr_nom_list = gr_nom_list + [
                    analyse_nominal_structure.fill_nom_gr(phrase, object, pos_object, conjunction)]

                #We take off the nominal group
                phrase = analyse_nominal_group.take_off_nom_gr(phrase, object, pos_object)
                #We will take off the proposal
                phrase = phrase[:phrase.index(proposal[0])] + phrase[phrase.index(proposal[0]) + 1:]
                conjunction = 'AND'

                #If there is a relative
                begin_pos_rel = analyse_nominal_group.find_relative(object, phrase, pos_object,
                                                                    ResourcePool().relatives)

                if begin_pos_rel != -1:
                    end_pos_rel = other_functions.recover_end_pos_sub(phrase, ResourcePool().relatives)
                    #We remove the relative part of the phrase
                    phrase = phrase[:begin_pos_rel] + phrase[end_pos_rel:]

                #If there is 'and', we need to duplicate the information with the proposal if there is
                if len(phrase) != 0 and (phrase[0] == 'and' or phrase[0] == 'or' or phrase[0] == ':but'):

                    phrase = [phrase[0]] + analyse_nominal_group.find_plural(phrase[1:])

                    #We have not duplicate the proposal, it depends on the presence of the nominal group after  
                    if analyse_nominal_group.find_sn_pos(phrase, 1):
                        phrase = [phrase[0]] + proposal + phrase[1:]
                    else:
                        phrase = [phrase[0]] + phrase[1:]

                    object = analyse_nominal_group.find_sn_pos(phrase[1:], 0)

                    #We process the 'or' like the 'and' and remove it
                    if phrase[0] == 'or':
                        conjunction = 'OR'
                    elif phrase[0] == ':but':
                        conjunction = 'BUT'
                    else:
                        conjunction = 'AND'
                    phrase = phrase[1:]

                else:
                    object = []

            vg.i_cmpl = vg.i_cmpl + [Indirect_Complement(proposal, gr_nom_list)]

        else:
            #It is a direct complement
            gr_nom_list = []
            #It reproduces the same code as above
            while object:
                pos_object = phrase.index(object[0])

                #We refine the nominal group if there is an error like ending with question mark
                object = analyse_nominal_group.refine_nom_gr(object)

                #Recovering nominal group
                gr_nom_list = gr_nom_list + [
                    analyse_nominal_structure.fill_nom_gr(phrase, object, pos_object, conjunction)]

                #We take off the nominal group
                phrase = analyse_nominal_group.take_off_nom_gr(phrase, object, pos_object)
                conjunction = 'AND'

                #If there is a relative
                begin_pos_rel = analyse_nominal_group.find_relative(object, phrase, pos_object,
                                                                    ResourcePool().relatives)

                if begin_pos_rel != -1:
                    end_pos_rel = other_functions.recover_end_pos_sub(phrase, ResourcePool().relatives)
                    #We remove the relative part of the phrase
                    phrase = phrase[:begin_pos_rel] + phrase[end_pos_rel:]

                if len(phrase) != 0 and (phrase[0] == 'and' or phrase[0] == 'or' or phrase[0] == ':but'):

                    phrase = [phrase[0]] + analyse_nominal_group.find_plural(phrase[1:])
                    object = analyse_nominal_group.find_sn_pos(phrase[1:], 0)

                    #We process the 'or' like the 'and' and remove it
                    if phrase[0] == 'or':
                        conjunction = 'OR'
                    elif phrase[0] == ':but':
                        conjunction = 'BUT'
                    else:
                        conjunction = 'AND'
                    phrase = phrase[1:]

                else:
                    object = []

            #In a sentence there is just one direct complement if there is no second verb
            if not vg.d_obj:
                vg.d_obj = gr_nom_list
            else:
                #Else the first nominal group found is indirect and this one is direct complement
                vg.i_cmpl = vg.i_cmpl + [Indirect_Complement([], vg.d_obj)]
                vg.d_obj = gr_nom_list

        #If the last nominal group is followed by another one in plural form 
        phrase = analyse_nominal_group.find_plural(phrase)
        object = analyse_nominal_group.find_sn(phrase)

    return phrase
        


src/d/i/Dialogs-0.13/src/dialogs/parsing/analyse_sentence.py   Dialogs(Download)
        sentence = analyse_nominal_group.find_plural(sentence)
        #We recover the direct, indirect complement and the adverbial
        sentence = analyse_verbal_structure.recover_obj_iobj(sentence, vg)
 
        #We have to take off adverbs form the sentence
        stc = analyse_verbal_structure.create_nom_gr(sentence, request)
        #We recover the direct, indirect complement and the adverbial
        stc = analyse_verbal_structure.recover_obj_iobj(stc, vg)
        if stc == sentence:
            #We leave the loop
    sentence = analyse_nominal_group.find_plural(sentence)
    #We recover the direct, indirect complement and the adverbial
    sentence = analyse_verbal_structure.recover_obj_iobj(sentence, vg)
 
    #We have to take off abverbs form the sentence
        stc = analyse_verbal_structure.create_nom_gr(sentence, request)
        #We recover the direct, indirect complement and the adverbial
        stc = analyse_verbal_structure.recover_obj_iobj(stc, vg)
        if stc == sentence:
            #We leave the loop