Exemplo n.º 1
0
def other_sentence(type, request, sentence):
    """
    process the other from of a sentence                                
    Input=type and requesting of sentence and the sentence                               
    Output=class Sentence                                                            
    """

    #init
    vg = VerbalGroup([], [], '', [], [], [], [], VerbalGroup.affirmative, [])
    analysis = Sentence(type, request, [], [])
    modal = []

    if not sentence:
        return []

    #We have to add punctuation if there is not
    if sentence[len(sentence) - 1] not in ['.', '?', '!']:
        sentence = sentence + ['.']

    #We start with determination of probably second verb in subsentence
    sentence = other_functions.find_scd_verb_sub(sentence)

    #We search the subject
    sbj = analyse_nominal_group.find_sn_pos(sentence, 0)

    if sbj != [] or type == RELATIVE:
        #If we haven't a data type => it is a statement
        if type == '':
            analysis.data_type = STATEMENT


        #We have to separate the case using these, this or there
        if sentence[0] in ResourcePool().demonstrative_det and analyse_verb.infinitive([sentence[1]],
                                                                                       'present simple') == ['be']:
            #We recover this information and remove it
            analysis.sn = [NominalGroup([sentence[0]], [], [], [], [])]
            if sentence[0] == 'there' and sentence[1] == 'are':
                analysis.sn[0]._quantifier = 'SOME'
            sentence = sentence[1:]

        if not analysis.sn:
            #We recover the subject
            sentence = analyse_nominal_structure.recover_ns(sentence, analysis, 0)

        #End of the sentence? -> nominal sentence
        if sentence == [] or sentence[0] in ['.', '!', '?']:
            analysis.sv = []
            return analysis

        #We have to know if there is a modal
        if sentence[0] in ResourcePool().modal:
            modal = sentence[0]
            if modal == 'can' or modal == 'must' or modal == 'shall' or modal == 'may':
                sentence = sentence[1:]

        #We must take into account all possible cases to recover the sentence's tense
        if len(sentence) > 1 and sentence[1] == 'not':
            vg.state = VerbalGroup.negative

            #Before the negative form we have an auxiliary for the negation
            if sentence[0] == 'do' or sentence[0] == 'does' or sentence[0] == 'did':
                vg.vrb_tense = analyse_verb.find_tense_statement([sentence[0]])
                sentence = sentence[2:]
                sentence = analyse_verbal_structure.delete_unusable_word(sentence)
                sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

            #There is a modal
            elif modal:
                sentence = [sentence[0]] + sentence[2:]
                sentence = analyse_verbal_structure.delete_unusable_word(sentence)
                sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
                vg.vrb_tense = analyse_verb.find_tense_statement(sentence)

            else:
                #We remove 'not' and find the tense
                sentence = sentence[:1] + sentence[2:]
                sentence = analyse_verbal_structure.delete_unusable_word(sentence)
                sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
                vg.vrb_tense = analyse_verb.find_tense_statement(sentence)

        #For the affirmative processing
        else:
            if sentence[0] == 'not':
                vg.state = VerbalGroup.negative
                sentence = sentence[1:]

            sentence = analyse_verbal_structure.delete_unusable_word(sentence)
            sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
            vg.vrb_tense = analyse_verb.find_tense_statement(sentence)

        verb = analyse_verb.find_verb_statement(sentence, vg.vrb_tense)
        verb_main = analyse_verb.return_verb(sentence, verb, vg.vrb_tense)
        vg.vrb_main = [other_functions.convert_to_string(verb_main)]

        #We delete the verb
        sentence = sentence[sentence.index(verb[0]) + len(verb_main):]

        #We perform the processing with the modal
        if modal:
            vg.vrb_main = [modal + '+' + vg.vrb_main[0]]

    #This is a imperative form
    else:
        #re-init
        analysis.data_type = IMPERATIVE
        vg.vrb_tense = 'present simple'

        if sentence[0] in ResourcePool().proposals:
            sentence = ['.'] + sentence

        #Negative form
        if sentence[1] == 'not':
            sentence = sentence[sentence.index('not') + 1:]
            sentence = analyse_verbal_structure.delete_unusable_word(sentence)
            sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
            vg.state = VerbalGroup.negative
        else:
            sentence = analyse_verbal_structure.delete_unusable_word(sentence)
            sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

        #We process the verb
        verb = [sentence[0]]
        verb_main = analyse_verb.return_verb(sentence, verb, vg.vrb_tense)
        vg.vrb_main = [other_functions.convert_to_string(verb_main)]

        #We delete the verb
        sentence = sentence[sentence.index(verb[0]) + len(verb_main):]

    if sentence and sentence[-1] == '?':
        analysis.data_type = YES_NO_QUESTION

    #We recover the conjunctive subsentence
    sentence = analyse_verbal_structure.process_conjunctive_sub(sentence, vg)

    #It verifies if there is a secondary verb
    sec_vrb = analyse_verbal_structure.find_scd_vrb(sentence)
    if sec_vrb:
        sentence = analyse_verbal_structure.process_scd_sentence(sentence, vg, sec_vrb)

    #We recover the subsentence
    sentence = analyse_verbal_structure.process_subsentence(sentence, vg)

    if sentence != [] and vg.vrb_main != []:
        #Process relative changes
        sentence = analyse_verbal_structure.correct_i_compl(sentence, vg.vrb_main[0])

    sentence = analyse_verbal_structure.process_compare(sentence, vg)

    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
    sentence = analyse_verbal_structure.find_adv(sentence, vg)

    #In case there is a state verb followed by an adjective
    sentence = analyse_verbal_structure.state_adjective(sentence, vg)

    #If there is a forgotten
    sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    while len(sentence) > 1:
        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
            break
        else:
            sentence = stc

    vg = analyse_verbal_structure.refine_indirect_complement(vg)
    vg = analyse_verbal_structure.refine_subsentence(vg)
    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    analysis.sv = [vg]
    return analysis
Exemplo n.º 2
0
def other_sentence(type, request, sentence):
    """
    process the other from of a sentence                                
    Input=type and requesting of sentence and the sentence                               
    Output=class Sentence                                                            
    """

    #init
    vg = VerbalGroup([], [], '', [], [], [], [], VerbalGroup.affirmative, [])
    analysis = Sentence(type, request, [], [])
    modal = []

    if not sentence:
        return []

    #We have to add punctuation if there is not
    if sentence[len(sentence) - 1] not in ['.', '?', '!']:
        sentence = sentence + ['.']

    #We start with determination of probably second verb in subsentence
    sentence = other_functions.find_scd_verb_sub(sentence)

    #We search the subject
    sbj = analyse_nominal_group.find_sn_pos(sentence, 0)

    if sbj != [] or type == RELATIVE:
        #If we haven't a data type => it is a statement
        if type == '':
            analysis.data_type = STATEMENT

        #We have to separate the case using these, this or there
        if sentence[0] in ResourcePool(
        ).demonstrative_det and analyse_verb.infinitive(
            [sentence[1]], 'present simple') == ['be']:
            #We recover this information and remove it
            analysis.sn = [NominalGroup([sentence[0]], [], [], [], [])]
            if sentence[0] == 'there' and sentence[1] == 'are':
                analysis.sn[0]._quantifier = 'SOME'
            sentence = sentence[1:]

        if not analysis.sn:
            #We recover the subject
            sentence = analyse_nominal_structure.recover_ns(
                sentence, analysis, 0)

        #End of the sentence? -> nominal sentence
        if sentence == [] or sentence[0] in ['.', '!', '?']:
            analysis.sv = []
            return analysis

        #We have to know if there is a modal
        if sentence[0] in ResourcePool().modal:
            modal = sentence[0]
            if modal == 'can' or modal == 'must' or modal == 'shall' or modal == 'may':
                sentence = sentence[1:]

        #We must take into account all possible cases to recover the sentence's tense
        if len(sentence) > 1 and sentence[1] == 'not':
            vg.state = VerbalGroup.negative

            #Before the negative form we have an auxiliary for the negation
            if sentence[0] == 'do' or sentence[0] == 'does' or sentence[
                    0] == 'did':
                vg.vrb_tense = analyse_verb.find_tense_statement([sentence[0]])
                sentence = sentence[2:]
                sentence = analyse_verbal_structure.delete_unusable_word(
                    sentence)
                sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

            #There is a modal
            elif modal:
                sentence = [sentence[0]] + sentence[2:]
                sentence = analyse_verbal_structure.delete_unusable_word(
                    sentence)
                sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
                vg.vrb_tense = analyse_verb.find_tense_statement(sentence)

            else:
                #We remove 'not' and find the tense
                sentence = sentence[:1] + sentence[2:]
                sentence = analyse_verbal_structure.delete_unusable_word(
                    sentence)
                sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
                vg.vrb_tense = analyse_verb.find_tense_statement(sentence)

        #For the affirmative processing
        else:
            if sentence[0] == 'not':
                vg.state = VerbalGroup.negative
                sentence = sentence[1:]

            sentence = analyse_verbal_structure.delete_unusable_word(sentence)
            sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
            vg.vrb_tense = analyse_verb.find_tense_statement(sentence)

        verb = analyse_verb.find_verb_statement(sentence, vg.vrb_tense)
        verb_main = analyse_verb.return_verb(sentence, verb, vg.vrb_tense)
        vg.vrb_main = [other_functions.convert_to_string(verb_main)]

        #We delete the verb
        sentence = sentence[sentence.index(verb[0]) + len(verb_main):]

        #We perform the processing with the modal
        if modal:
            vg.vrb_main = [modal + '+' + vg.vrb_main[0]]

    #This is a imperative form
    else:
        #re-init
        analysis.data_type = IMPERATIVE
        vg.vrb_tense = 'present simple'

        if sentence[0] in ResourcePool().proposals:
            sentence = ['.'] + sentence

        #Negative form
        if sentence[1] == 'not':
            sentence = sentence[sentence.index('not') + 1:]
            sentence = analyse_verbal_structure.delete_unusable_word(sentence)
            sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
            vg.state = VerbalGroup.negative
        else:
            sentence = analyse_verbal_structure.delete_unusable_word(sentence)
            sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

        #We process the verb
        verb = [sentence[0]]
        verb_main = analyse_verb.return_verb(sentence, verb, vg.vrb_tense)
        vg.vrb_main = [other_functions.convert_to_string(verb_main)]

        #We delete the verb
        sentence = sentence[sentence.index(verb[0]) + len(verb_main):]

    if sentence and sentence[-1] == '?':
        analysis.data_type = YES_NO_QUESTION

    #We recover the conjunctive subsentence
    sentence = analyse_verbal_structure.process_conjunctive_sub(sentence, vg)

    #It verifies if there is a secondary verb
    sec_vrb = analyse_verbal_structure.find_scd_vrb(sentence)
    if sec_vrb:
        sentence = analyse_verbal_structure.process_scd_sentence(
            sentence, vg, sec_vrb)

    #We recover the subsentence
    sentence = analyse_verbal_structure.process_subsentence(sentence, vg)

    if sentence != [] and vg.vrb_main != []:
        #Process relative changes
        sentence = analyse_verbal_structure.correct_i_compl(
            sentence, vg.vrb_main[0])

    sentence = analyse_verbal_structure.process_compare(sentence, vg)

    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
    sentence = analyse_verbal_structure.find_adv(sentence, vg)

    #In case there is a state verb followed by an adjective
    sentence = analyse_verbal_structure.state_adjective(sentence, vg)

    #If there is a forgotten
    sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    while len(sentence) > 1:
        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
            break
        else:
            sentence = stc

    vg = analyse_verbal_structure.refine_indirect_complement(vg)
    vg = analyse_verbal_structure.refine_subsentence(vg)
    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    analysis.sv = [vg]
    return analysis
Exemplo n.º 3
0
def y_n_ques(type, request, sentence):
    """
    process the yes or no question from of a sentence
    Input=type and requesting of sentence and the sentence                           
    Output=class Sentence                                                            
    """

    #init
    vg = VerbalGroup([], [], '', [], [], [], [], VerbalGroup.affirmative, [])
    analysis = Sentence(type, request, [], [])
    modal = []
    stc = sentence

    #We start with determination of probably second verb in subsentence
    sentence = other_functions.find_scd_verb_sub(sentence)

    #We have to add punctuation if there is not
    if sentence == [] or sentence[0] == '.' or sentence[0] == '?' or sentence[0] == '!':
        #We have probably the aim as an adverb
        analyse_verbal_structure.find_adv([request], vg)
        analysis.aim = 'thing'
        analysis.sv = [vg]
        return analysis

    #We recover the auxiliary 
    aux = sentence[0]

    #We have to know if there is a modal
    if aux in ResourcePool().modal:
        modal = aux

    #If we have a negative form
    if sentence[1] == 'not':
        vg.state = VerbalGroup.negative
        #We remove 'not'
        sentence = sentence[:1] + sentence[2:]

    #Wrong is a noun but not followed by the determinant
    if sentence[1] == 'wrong' and request == 'thing':
        analysis.sn = [NominalGroup([], [], ['wrong'], [], [])]
        sentence = [sentence[0]] + sentence[2:]

    #In this case we have an imperative sentence
    elif analyse_nominal_group.find_sn_pos(sentence, 1) == [] and type != W_QUESTION:
        #We have to reput the 'not'
        if vg.state == VerbalGroup.negative:
            sentence = sentence[:1] + ['not'] + sentence[1:]
        return other_sentence(type, request, sentence)

    #We delete the auxiliary
    sentence = sentence[1:]

    #We have to separate the case using these, this or there
    if sentence[0] in ResourcePool().demonstrative_det and analyse_verb.infinitive([aux], 'present simple') == ['be']:
        #If we have a verb or an adverb just after (if not, we have a noun)
        if sentence[0].endswith('ed') or sentence[0].endswith('ing') or sentence[0].endswith('ly') or sentence[
            0] in ResourcePool().adverbs:
            #We recover this information and remove it
            analysis.sn = [NominalGroup([sentence[0]], [], [], [], [])]
            if sentence[0] == 'there' and aux == 'are':
                analysis.sn[0]._quantifier = 'SOME'
            sentence = sentence[1:]

    if not analysis.sn:
        #We recover the subject
        sentence = analyse_nominal_structure.recover_ns(sentence, analysis, 0)

    if aux == 'do' and not analyse_verbal_structure.can_be_imperative(sentence):
        return other_sentence('', '', stc)

    #If there is one element => it is an auxiliary => verb 'be'
    if len(sentence) == 0:
        vg.vrb_tense = analyse_verb.find_tense_statement(aux)
        vg.vrb_main = ['be']
    else:
        sentence = analyse_verbal_structure.delete_unusable_word(sentence)
        sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
        vg.vrb_tense = analyse_verb.find_tense_question(sentence, aux)

        #We process the verb
        verb = analyse_verb.find_verb_question(sentence, aux, vg.vrb_tense)
        verb_main = analyse_verb.return_verb(sentence, verb, vg.vrb_tense)
        vg.vrb_main = [other_functions.convert_to_string(verb_main)]

        #We delete the verb if the aux is not the verb 'be'
        if vg.vrb_main != ['be']:
            sentence = sentence[sentence.index(verb[0]) + len(verb_main):]
        elif sentence[0] == 'be':
            sentence = sentence[1:]

        #Here we have special processing for different cases
        if sentence:
            #For 'what' descrition case
            if sentence[0] == 'like' and aux != 'would':
                vg.vrb_main = ['like']
                sentence = sentence[1:]

            #For 'how' questions with often
            elif sentence[0].endswith('ing') and not (sentence[0].endswith('thing')):
                vg.vrb_main[0] = vg.vrb_main[0] + '+' + sentence[0]
                sentence = sentence[1:]

        #We recover the conjunctive subsentence
        sentence = analyse_verbal_structure.process_conjunctive_sub(sentence, vg)

        #It verifies if there is a secondary verb
        sec_vrb = analyse_verbal_structure.find_scd_vrb(sentence)
        if sec_vrb:
            sentence = analyse_verbal_structure.process_scd_sentence(sentence, vg, sec_vrb)

        #We recover the subsentence
        sentence = analyse_verbal_structure.process_subsentence(sentence, vg)

        #Process relative changes
        sentence = analyse_verbal_structure.correct_i_compl(sentence, vg.vrb_main[0])

        sentence = analyse_verbal_structure.process_compare(sentence, vg)

        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
        sentence = analyse_verbal_structure.find_adv(sentence, vg)

    #We perform the processing with the modal
    if modal:
        vg.vrb_main = [modal + '+' + vg.vrb_main[0]]

    #If there is a forgotten
    sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

    #In case there is a state verb followed by an adjective
    sentence = analyse_verbal_structure.state_adjective(sentence, vg)

    #We have to correct the mistake of the subject
    for p in ResourcePool().demonstrative_det:
        if analysis.sn and analysis.sn[0].det == [p] and analysis.sn[0].noun == []:
            if sentence != [0] and sentence[0] == '.' and sentence[0] == '?' and sentence[0] == '!':
                if sentence[0] in ResourcePool().proposals:
                    pass
                else:
                    analysis.sn[0].noun = [sentence[0]]
                    sentence = sentence[1:]
                    sentence = analyse_verbal_structure.state_adjective(sentence, vg)

    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    while len(sentence) > 1:
        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
            break
        else:
            sentence = stc

    vg = analyse_verbal_structure.refine_indirect_complement(vg)
    vg = analyse_verbal_structure.refine_subsentence(vg)
    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    analysis.sv = [vg]
    return analysis
Exemplo n.º 4
0
def y_n_ques(type, request, sentence):
    """
    process the yes or no question from of a sentence
    Input=type and requesting of sentence and the sentence                           
    Output=class Sentence                                                            
    """

    #init
    vg = VerbalGroup([], [], '', [], [], [], [], VerbalGroup.affirmative, [])
    analysis = Sentence(type, request, [], [])
    modal = []
    stc = sentence

    #We start with determination of probably second verb in subsentence
    sentence = other_functions.find_scd_verb_sub(sentence)

    #We have to add punctuation if there is not
    if sentence == [] or sentence[0] == '.' or sentence[0] == '?' or sentence[
            0] == '!':
        #We have probably the aim as an adverb
        analyse_verbal_structure.find_adv([request], vg)
        analysis.aim = 'thing'
        analysis.sv = [vg]
        return analysis

    #We recover the auxiliary
    aux = sentence[0]

    #We have to know if there is a modal
    if aux in ResourcePool().modal:
        modal = aux

    #If we have a negative form
    if sentence[1] == 'not':
        vg.state = VerbalGroup.negative
        #We remove 'not'
        sentence = sentence[:1] + sentence[2:]

    #Wrong is a noun but not followed by the determinant
    if sentence[1] == 'wrong' and request == 'thing':
        analysis.sn = [NominalGroup([], [], ['wrong'], [], [])]
        sentence = [sentence[0]] + sentence[2:]

    #In this case we have an imperative sentence
    elif analyse_nominal_group.find_sn_pos(sentence,
                                           1) == [] and type != W_QUESTION:
        #We have to reput the 'not'
        if vg.state == VerbalGroup.negative:
            sentence = sentence[:1] + ['not'] + sentence[1:]
        return other_sentence(type, request, sentence)

    #We delete the auxiliary
    sentence = sentence[1:]

    #We have to separate the case using these, this or there
    if sentence[0] in ResourcePool(
    ).demonstrative_det and analyse_verb.infinitive(
        [aux], 'present simple') == ['be']:
        #If we have a verb or an adverb just after (if not, we have a noun)
        if sentence[0].endswith('ed') or sentence[0].endswith(
                'ing') or sentence[0].endswith(
                    'ly') or sentence[0] in ResourcePool().adverbs:
            #We recover this information and remove it
            analysis.sn = [NominalGroup([sentence[0]], [], [], [], [])]
            if sentence[0] == 'there' and aux == 'are':
                analysis.sn[0]._quantifier = 'SOME'
            sentence = sentence[1:]

    if not analysis.sn:
        #We recover the subject
        sentence = analyse_nominal_structure.recover_ns(sentence, analysis, 0)

    if aux == 'do' and not analyse_verbal_structure.can_be_imperative(
            sentence):
        return other_sentence('', '', stc)

    #If there is one element => it is an auxiliary => verb 'be'
    if len(sentence) == 0:
        vg.vrb_tense = analyse_verb.find_tense_statement(aux)
        vg.vrb_main = ['be']
    else:
        sentence = analyse_verbal_structure.delete_unusable_word(sentence)
        sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)
        vg.vrb_tense = analyse_verb.find_tense_question(sentence, aux)

        #We process the verb
        verb = analyse_verb.find_verb_question(sentence, aux, vg.vrb_tense)
        verb_main = analyse_verb.return_verb(sentence, verb, vg.vrb_tense)
        vg.vrb_main = [other_functions.convert_to_string(verb_main)]

        #We delete the verb if the aux is not the verb 'be'
        if vg.vrb_main != ['be']:
            sentence = sentence[sentence.index(verb[0]) + len(verb_main):]
        elif sentence[0] == 'be':
            sentence = sentence[1:]

        #Here we have special processing for different cases
        if sentence:
            #For 'what' descrition case
            if sentence[0] == 'like' and aux != 'would':
                vg.vrb_main = ['like']
                sentence = sentence[1:]

            #For 'how' questions with often
            elif sentence[0].endswith('ing') and not (
                    sentence[0].endswith('thing')):
                vg.vrb_main[0] = vg.vrb_main[0] + '+' + sentence[0]
                sentence = sentence[1:]

        #We recover the conjunctive subsentence
        sentence = analyse_verbal_structure.process_conjunctive_sub(
            sentence, vg)

        #It verifies if there is a secondary verb
        sec_vrb = analyse_verbal_structure.find_scd_vrb(sentence)
        if sec_vrb:
            sentence = analyse_verbal_structure.process_scd_sentence(
                sentence, vg, sec_vrb)

        #We recover the subsentence
        sentence = analyse_verbal_structure.process_subsentence(sentence, vg)

        #Process relative changes
        sentence = analyse_verbal_structure.correct_i_compl(
            sentence, vg.vrb_main[0])

        sentence = analyse_verbal_structure.process_compare(sentence, vg)

        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
        sentence = analyse_verbal_structure.find_adv(sentence, vg)

    #We perform the processing with the modal
    if modal:
        vg.vrb_main = [modal + '+' + vg.vrb_main[0]]

    #If there is a forgotten
    sentence = analyse_verbal_structure.find_vrb_adv(sentence, vg)

    #In case there is a state verb followed by an adjective
    sentence = analyse_verbal_structure.state_adjective(sentence, vg)

    #We have to correct the mistake of the subject
    for p in ResourcePool().demonstrative_det:
        if analysis.sn and analysis.sn[0].det == [
                p
        ] and analysis.sn[0].noun == []:
            if sentence != [0] and sentence[0] == '.' and sentence[
                    0] == '?' and sentence[0] == '!':
                if sentence[0] in ResourcePool().proposals:
                    pass
                else:
                    analysis.sn[0].noun = [sentence[0]]
                    sentence = sentence[1:]
                    sentence = analyse_verbal_structure.state_adjective(
                        sentence, vg)

    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    while len(sentence) > 1:
        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
            break
        else:
            sentence = stc

    vg = analyse_verbal_structure.refine_indirect_complement(vg)
    vg = analyse_verbal_structure.refine_subsentence(vg)
    vg = analyse_verbal_structure.DOC_to_IOC(vg)

    analysis.sv = [vg]
    return analysis