Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

ProLog Program of asking question

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 6239

Program of asking question...........

Code for ProLog Program of asking question in Artificial Intelligence

trace
domains
    l = string*
predicates
    repeat
    start
    breakQ(string,l,l)
    rev(l,l,l)
    find(l)
    data(string,string,string)
clauses
    data("how","you","i am finw,what about you").
    data("what","do","lets play").
    data("where","it","it is into the cupboard").
    data("which","your","its mine").
    
    repeat.
    repeat:-
        repeat.
        
    start:-
        repeat,
        write("Ask Question::"),
        readln(Que),
        breakQ(Que,Old,Act_L),
        rev(Act_L,[],Re),
        find(Re).
    breakQ(Que,Old,Act):-
        Que<>"",
        fronttoken(Que,Token,Rem),
        New = [Token|Old],
        breakQ(Rem,New,Act).
    breakQ(Que,New,Act):-
        Act = New.
    rev([],R,R).
    rev([Head|Act_L],R,T):-
        rev(Act_L,[Head|R],T).
    find([X,Y,Z|Tail]):-
        data(X,Z,F),
        write(F).
  
Share: 


Didn't find what you were looking for? Find more on ProLog Program of asking question Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of ProLog Program of asking question is from India.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!