Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Function to find the position of the relative                                    

:param nominal_group: the object of the relative 
:param sentence: the sentence to search in 
:param position: the nominal group position
:param propo_rel_list: the relative's proposal's list
:return: the position of the relative or -1 if there is no relative                                        

        def find_relative(nominal_group, sentence, position, propo_rel_list):
    """
    Function to find the position of the relative                                    

    :param nominal_group: the object of the relative 
    :param sentence: the sentence to search in 
    :param position: the nominal group position
    :param propo_rel_list: the relative's proposal's list
    :return: the position of the relative or -1 if there is no relative                                        
    """

    # Nominal group or sentence is empty
    if not nominal_group or not sentence:
        return -1

    # Relative motion is obtained after a proposal

    # We deleted all nominal groups and their complements 
    # => we have not nominal_group+relative but relative only
    if sentence[0:len(nominal_group)] != nominal_group \
        and sentence[0] in propo_rel_list:
        return 0
        #The proposal is after the nominal group
    if len(sentence) > len(nominal_group) + position + 1 \
        and sentence[position + len(nominal_group)] in propo_rel_list:
        return position + len(nominal_group)

    return -1
        


src/d/i/Dialogs-0.13/src/dialogs/parsing/analyse_nominal_structure.py   Dialogs(Download)
 
    #We process the relative
    begin_pos_rel = analyse_nominal_group.find_relative(nom_gr, phrase, pos_nom_gr, ResourcePool().relatives)
    end_pos_rel = other_functions.recover_end_pos_sub(phrase[begin_pos_rel:], ResourcePool().relatives)
 

src/d/i/Dialogs-0.13/src/dialogs/parsing/analyse_verbal_structure.py   Dialogs(Download)
 
                #If there is a relative
                begin_pos_rel = analyse_nominal_group.find_relative(object, phrase, pos_object,
                                                                    ResourcePool().relatives)
 
 
                #If there is a relative
                begin_pos_rel = analyse_nominal_group.find_relative(object, phrase, pos_object,
                                                                    ResourcePool().relatives)
 
                conjunction = 'AND'
                #If there is a relative
                begin_pos_rel = analyse_nominal_group.find_relative(object, sentence, i + 1, ResourcePool().relatives)
                if begin_pos_rel != -1:
                    end_pos_rel = other_functions.recover_end_pos_sub(sentence, ResourcePool().relatives)