Did I find the right examples for you? yes no

All Samples(5)  |  Call(5)  |  Derive(0)  |  Import(0)
Retrieves the nominal structure of the sentence

:param list phrase: sentence
:param Sentence analysis: the instance of class sentence
:param position: the position of the nominal structure

:return: the class sentence and sentence

        def recover_ns(phrase, analysis, position):
    """ Retrieves the nominal structure of the sentence

    :param list phrase: sentence
    :param Sentence analysis: the instance of class sentence
    :param position: the position of the nominal structure

    :return: the class sentence and sentence
    """

    #init
    conjunction = 'AND'

    #We recover the first part of the subject
    sbj = analyse_nominal_group.find_sn_pos(phrase, position)

    #We loop until we don't have a nominal group
    while sbj:

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

        analysis.sn = analysis.sn + [fill_nom_gr(phrase, sbj, position, conjunction)]

        #We take off the nominal group
        phrase = analyse_nominal_group.take_off_nom_gr(phrase, sbj, phrase.index(sbj[0]))

        if phrase[0] in ResourcePool().relatives:
            end_pos_rel = other_functions.recover_end_pos_sub(phrase, ResourcePool().relatives)
            #We remove the relative part of the phrase
            phrase = phrase[end_pos_rel:]

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

            #Reperform the 'and' or 'or' processing
            sbj = analyse_nominal_group.find_sn_pos(phrase[1:], position)

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

            #This case is used by whose
            if not sbj:
                phrase = ['that'] + phrase
                sbj = analyse_nominal_group.find_sn_pos(phrase, position)

        else:
            sbj = []

    return phrase
        


src/d/i/Dialogs-0.13/src/dialogs/parsing/analyse_sentence.py   Dialogs(Download)
                analysis = Sentence(INTERJECTION, '', [], [])
                #We recover the subject
                sentence = analyse_nominal_structure.recover_ns(sentence, analysis, 1)
                return analysis
            elif i[1] == '2':
                #It is an exclamation sentence
                analysis = Sentence(EXCLAMATION, '', [], [])
                #We recover the subject
                sentence = analyse_nominal_structure.recover_ns(sentence, analysis, 0)
 
    #We recover the subject
    sentence = analyse_nominal_structure.recover_ns(sentence, analysis, 0)
 
    if sentence[1] == 'not':
    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):
        if not analysis.sn:
            #We recover the subject
            sentence = analyse_nominal_structure.recover_ns(sentence, analysis, 0)
 
        #End of the sentence? -> nominal sentence