Newer
Older
ai / lab4 / testMatch.py
@Andreas Jaggi Andreas Jaggi on 10 Apr 2006 1 KB Add existing code.
print "Test fonction match(daum,proposition)"
a=match(['vincent', 'est un', 'doctorant'],['?x', 'est un', 'doctorant'])
print "\t",a
print "\t",{'?x':'vincent'}
b=match(['vincent', 'est un', 'doctorant'],['?x', 'est un', '?y'])
print "\t",b
print "\t",{'?x':'vincent','?y':'doctorant'}
a=match(['vincent', 'est un', 'doctorant'] , ['vincent', 'est un', 'doctorant'])
print "\t",a
print "\t",{}
b=match(['vincent', 'est un', 'doctorant'],['?x', 'est un', '?x'])
print "\t",b
print "\t",echec
f=match( ['foo', 'jean', ['marc', 'bar', 'jean']],['foo', '?x', ['?y', 'bar', '?x']])
print "\t",f
print "\t",{'?x':'jean','?y':'marc'}
g=match(['foo', 'jean', ['marc', 'bar', 'paul']],['foo', '?x', ['?y', 'bar', '?x']])
print "\t",g
print "\t",echec

c=match(['vincent', 'est un', 'doctorant'],['?x', 'est un', 'doctorant'] , {'?y':'doctorant'})
print "\t",c
print "\t",{'?x':'vincent','?y':'doctorant'}
c=match(['vincent', 'est un', 'doctorant'],['?x', 'est un', '?y'] , {'?y':'doctorant'})
print "\t",c
print "\t",{'?x':'vincent','?y':'doctorant'}
d=match(['vincent', 'est un', 'doctorant'], ['?x', 'est un','doctorant'] , 'ECHEC')
print "\t",d
print "\t",echec
e=match('vincent','?x',  'ECHEC')
print "\t",e
print "\t",echec
e=match( 'vincent', '?x',{})
print "\t",e
print "\t",{'?x':'vincent'}