Did I find the right examples for you? yes no

All Samples(17)  |  Call(16)  |  Derive(0)  |  Import(1)
Function to compare 2 nominal groups

        def compare_nominal_group(ng, rslt_ng):
    """
    Function to compare 2 nominal groups
    """

    #init
    i = 0
    j = 0

    if len(ng) != len(rslt_ng):
        return 1
    else:
        while i < len(rslt_ng):
            if rslt_ng[i].det != ng[i].det or rslt_ng[i].adj != ng[i].adj or rslt_ng[i].noun != ng[i].noun:
                return 1

            #We compare the noun complement
            if compare_nominal_group(rslt_ng[i].noun_cmpl, ng[i].noun_cmpl) == 1:
                return 1

            #We compare the relative
            if len(rslt_ng[i].relative) != len(ng[i].relative):
                return 1
            else:
                while j < len(rslt_ng[i].relative):
                    if compare_sentence(rslt_ng[i].relative[j], ng[i].relative[j]) == 1:
                        return 1
                    j += 1

                #reinit
                j = 0

            #We compare the flag (if there is an 'or' or an 'and')
            if rslt_ng[i]._conjunction != ng[i]._conjunction:
                return 1
            if rslt_ng[i]._quantifier != ng[i]._quantifier:
                return 1
            i += 1
        return 0
        


src/d/i/Dialogs-0.13/src/dialogs/interpretation/anaphora_test.py   Dialogs(Download)
from dialogs.parsing import parser
from anaphora_matching import *
from dialogs.parsing.parser_test import compare_nominal_group
 
 
 
        result = Nominal_Group(['the'], ['table'], [], [], [])
        result_test = compare_nominal_group([gr], [result])
        self.assertEquals(result_test, 0)
 
 
        result = Nominal_Group(['the'], ['shelf'], [], [], [])
        result_test = compare_nominal_group([nominal_group_struc[0]], [result])
        self.assertEquals(result_test, 0)
 
 
        result = Nominal_Group(['the'], ['table'], [], [], [])
        result_test = compare_nominal_group([gr], [result])
        self.assertEquals(result_test, 0)
 
 
        result = Nominal_Group(['the'], ['bottle'], [], [], [])
        result_test = compare_nominal_group([nominal_group_struc[0]], [result])
        self.assertEquals(result_test, 0)