<style>
pre code.bash {
background: lightyellow;
}
</style>
Konsultiere babyCurt.pl
und starte den Curt-Dialog mit curt.
. Folgende reservierte Befehle stehen während dem Dialog zur Verfügung:
Teste ein paar Dialoge.
Studiere die Implementierung in babyCurt.pl
und curtPredicates.pl
Zentrale Klausel:
curtUpdate(Input,[accept],run):-
kellerStorage(Input,Readings), !,
updateHistory(Input),
combine(Readings,NewReadings),
updateReadings(NewReadings).
rugratCurt.pl
> mia does smoke.
Curt: OK.
> mia does not smoke.
Message (consistency checking): proof found.
Curt: No! I do not believe that!
Zentrale Klauseln:
curtUpdate(Input,Moves,run):-
kellerStorage(Input,Readings), !,
updateHistory(Input),
consistentReadings(Readings,[]-ConsReadings),
(
ConsReadings=[],
Moves=[contradiction]
;
\+ ConsReadings=[],
Moves=[accept],
combine(ConsReadings,CombinedReadings),
updateReadings(CombinedReadings)
).
/*========================================================================
Select Consistent Readings
========================================================================*/
consistentReadings([],C-C).
consistentReadings([New|Readings],C1-C2):-
readings(Old),
(
consistent(Old,New), !,
consistentReadings(Readings,[New|C1]-C2)
;
consistentReadings(Readings,C1-C2)
).
/*========================================================================
Consistency Checking calling Theorem Prover
========================================================================*/
consistent([Old|_],New):-
rprove(not(and(Old,New))), !,
nl, write('Message (consistency checking): proof found.'),
fail.
consistent([],New):-
rprove(not(New)), !,
nl, write('Message (consistency checking): proof found.'),
fail.
consistent(_,_).
Probleme mit rugratCurt:
> every woman smokes.
Curt: OK.
> mia is a woman.
Curt: OK.
> mia does not smoke.
Curt: OK.
zentrale Klauseln:
curtUpdate(Input,Moves,run):-
kellerStorage(Input,Readings), !,
updateHistory(Input),
consistentReadings(Readings,[]-ConsReadings,[]-Models),
(
ConsReadings=[],
Moves=[contradiction]
;
\+ ConsReadings=[],
Moves=[accept],
combine(ConsReadings,CombinedReadings),
updateReadings(CombinedReadings),
updateModels(Models)
).
/*========================================================================
Select Consistent Readings
========================================================================*/
consistentReadings([],C-C,M-M).
consistentReadings([New|Readings],C1-C2,M1-M2):-
readings(Old),
(
consistent(Old,New,Model), !,
consistentReadings(Readings,[New|C1]-C2,[Model|M1]-M2)
;
consistentReadings(Readings,C1-C2,M1-M2)
).
/*========================================================================
Consistency Checking calling Theorem Prover and Model Builder
========================================================================*/
consistent([Old|_],New,Model):-
DomainSize=15,
callTPandMB(not(and(Old,New)),and(Old,New),DomainSize,Proof,Model,Engine),
format('~nMessage (consistency checking): ~p found a result.',[Engine]),
\+ Proof=proof, Model=model([_|_],_).
consistent([],New,Model):-
DomainSize=15,
callTPandMB(not(New),New,DomainSize,Proof,Model,Engine),
format('~nMessage (consistency checking): ~p found a result.',[Engine]),
\+ Proof=proof, Model=model([_|_],_).
curtUpdate(Input,Moves,run):-
kellerStorage(Input,Readings), !,
updateHistory(Input),
consistentReadings(Readings,[]-ConsReadings,[]-Models),
(
ConsReadings=[],
Moves=[contradiction]
;
\+ ConsReadings=[],
informativeReadings(ConsReadings,[]-InfReadings),
(
InfReadings=[],
Moves=[obvious]
;
\+ InfReadings=[],
Moves=[accept]
),
combine(ConsReadings,CombinedReadings),
updateReadings(CombinedReadings),
updateModels(Models)
).
/*========================================================================
Select Informative Readings
========================================================================*/
informativeReadings([],I-I).
informativeReadings([New|L],I1-I2):-
readings(Old),
(
informative(Old,New), !,
informativeReadings(L,[New|I1]-I2)
;
informativeReadings(L,I1-I2)
).
/*========================================================================
Informativity Checking calling Theorem Prover
========================================================================*/
informative([Old|_],New):-
DomainSize=15,
callTPandMB(not(and(Old,not(New))),and(Old,not(New)),DomainSize,Proof,Model,Engine),
format('~nMessage (informativity checking): ~p found a result.',[Engine]),
\+ Proof=proof, Model=model([_|_],_).
informative([],New):-
DomainSize=15,
callTPandMB(New,not(New),DomainSize,Proof,Model,Engine),
format('~nMessage (informativity checking): ~p found a result.',[Engine]),
\+ Proof=proof, Model=model([_|_],_).
Betrachte den folgenden Textverlauf. Folgt der letzte Satz logisch aus den ersten beiden? Ist er also uninformativ? Was sagt Curt und warum?
Sensitive Curt ist nicht in der Lage äquivalente Lesarten zu erkennen und zu elminieren:
Schaue dir folgende Dateien an:
lexicalKnowledge.pl
worldKnowledge.pl
situationalKnowledge.pl
backgroundKnowledge.pl
knowledgeableCurt.pl