Did I find the right examples for you? yes no

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
This function recovers nominal structure                                         
Input=class nominal structure                                                    
Output=phrase concatenate all information of this class                             

        def nom_struc_rebuilding(nom_struc):
    """
    This function recovers nominal structure                                         
    Input=class nominal structure                                                    
    Output=phrase concatenate all information of this class                             
    """

    #init
    nominal_structure = ns = nn = []
    i = 0

    while i < len(nom_struc):

        if nom_struc[i]._quantifier == 'SOME' and (nom_struc[i].det == ['a'] or nom_struc[i].det == ['an']):
            nom_struc[i]._quantifier = 'ONE'

        #The first nominal group not preceded but 'and' if there is
        if nom_struc[i]._conjunction == 'AND' and i > 0:
            nominal_structure = nominal_structure + ['and']
        elif nom_struc[i]._conjunction == 'OR':
            nominal_structure = nominal_structure + ['or']
        elif nom_struc[i]._conjunction == 'BUT':
            nominal_structure = nominal_structure + ['but']

        #We recover the nominal group and his complement
        if nom_struc[i]._quantifier == 'SOME' or nom_struc[i]._quantifier == 'ALL' or nom_struc[
            i]._quantifier == 'ANY' or (nom_struc[i]._quantifier == 'DIGIT' and nom_struc[i].det != 'one'):
            #If there is a specific quantifier (plural)
            for n in ResourcePool().plural_nouns:
                if nom_struc[i].noun != [] and n[1] == nom_struc[i].noun[0]:
                    nn = [n[0]]

            #If it is not a specific plural, we add 's'
            if nom_struc[i].noun != [] and nn == []:
                nn = [nom_struc[i].noun[0] + 's']

            #We reconver the other information   
            nominal_structure = nominal_structure + nom_struc[i].det
            for z in nom_struc[i].adj:
                nominal_structure = nominal_structure + z[1] + [z[0]]
            nominal_structure = nominal_structure + nn

            #Re-init
            nn = []

        else:
            #if not plural
            nominal_structure = nominal_structure + nom_struc[i].det
            for z in nom_struc[i].adj:
                nominal_structure = nominal_structure + z[1] + [z[0]]
            nominal_structure = nominal_structure + nom_struc[i].noun

        #We recover noun complement
        if nom_struc[i].noun_cmpl:
            nominal_structure = nominal_structure + ['of']
            nominal_structure = nominal_structure + nom_struc_rebuilding(nom_struc[i].noun_cmpl)

        #We recover the relative
        for j in nom_struc[i].relative:
            if not j.sn:
                ns = [nom_struc[i]]

            nominal_structure = nominal_structure + [j.aim] + sentence_rebuilding.relative(j, ns)
            ns = []

        i += 1
    return nominal_structure
        


src/d/i/Dialogs-0.13/src/dialogs/verbalization/sentence_rebuilding.py   Dialogs(Download)
 
    #Recovering the subject
    phrase = element_rebuilding.nom_struc_rebuilding(analysis.sn)
 
    if not phrase:
 
    #Recovering the subject
    subject = element_rebuilding.nom_struc_rebuilding(analysis.sn)
 
    if analysis.sv:
        #Third case : as yes no question without the direct complement
        else:
            subject = element_rebuilding.nom_struc_rebuilding(analysis.sn)
 
            #Same processing with yes no question