, . , . . , , . . .
. , .
. 18.8 , . : , , , , . , . , . , . , , . , :
size: small, large % : ,
shape: long, compact, other % : , ,
holes: none, I, 2, 3, many % : , 1, 2, 3,
18. 419
? |
/>
. 18.8. ,
, . 18.1 , Prolog :
example [ Class, [ ftttributel = Vail, Attribute 2 - Vai2,,,,]).
18,1. ( . 18.8)
attribute! size, [ small, large]). attribute! shape, [ long, compact, other]). attribute! holes, [ none, 1, 2, 3, many]).
example[
example
example
example
example
example
example
example
example
example
example
example
nut, [ size = small, shape = compact, holes =1]). screw, [ size - small, shape = long, holes = none]). key, [ size - small, shape = long, holes = 1]). nut, [ size = small, shape - compact, holes = 1]). key, [ size - large, shape = long, holes =1]). screw, [ size - small, shape = compact, holes = none]) nut, [ size = small, shape - compact, holes - 1]). pen, [ size = large, shape = long, holes = none]). scissors, [ size = large, shape = long, holes =2]). pen,; size = large, shape = long, holes = none]), scissors, [ size = large, shape = other, holes -2]). key,: size = small, shape = other, holes =2)).
|
|
, , . -
II- Prolog
, . nut () key ().
nut <= = [[ size = small, holes = 1]]
key <== [[ shape = long, holes = 1], [ shape = other, holes = 2] ]
, .
,
.
,
.
:
Class <= = [ Conjl, Conj2,... ]
Conjl, Conj2 .. :
[ Attl =Vall, Att2 = Val2,... ]
[ Conjl, Conj2___ ] .
1. , , , Conjl, Conj2 ..
2. Conj, , .
, ,
[ size = small, shape = long, holes = 1]
key, . , Conj ; , . , Conjl, Conj2 .. ; , .
Prolog :
match (Object, Description):-
member (Conjunction, Description), satisfy (Object, Conjunction).
satisfy (Object, Conjunction):-not (
member) Att = Val, Conjunction), %
member (Att = ValX, Object), %
ValX \== Val). %
, , , , . , , Conjunction.
18. 421