×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

micro watson prolog(answering question).

micro watson prolog(answering question).

micro watson prolog(answering question).

(OP)
hi everyone.

i'm having a problem with program, the main aim of it is to display question and check against the answer the user gave, to see if its correct.

the problem i'm having is trying to check to see if the answer given is correct.

micro_watson:-
        write('Micro Watson, Olympic Edition'),nl,nl,
        write('Categories:'),nl,
        write('1. London 2012'),nl,
        write('2. Modern Olympic Games'),nl,
        write('3. Ancient Olympic Games'),nl,
        write('Enter your Category: '), read(X),nl,nl,
        write('micro_watson: '), mode(X),
        write(' '),
        read(Answer),
        write(Answer),
        sentence(Answer).

mode(1):-
              write('London 2012').
mode(2):-
              write('Modern Olympic Games').
mode(3):-
              write('Ancient Olympic Games').


question('Who won two track gold medal in the 2004 Summer Olympics in Athens', [adjective(two_time),noun(winner),vern(was),noun(kelly_homes)]).
question('Who won Decathlon Goal Medals in the 1980 and 1984 Summer Olympics', [adjective(two_time),noun(winner),vern(was),noun(daley_thompson)]).
question('Who won the Mens 100M at the 1980 Summer Olympics', [adjective(single_time),noun(winner),vern(was),noun(alan_wells)]).
question('In all olympic history who won the most goals medals', [verb(all_time), verb(record),noun(goldmelist),verb(was),noun(marc_spitz)]).
question('In the history of the winter olympics who was perhaps the worst sky jumper', [noun(eddie_the_eagle),adverb(really),verb(was),ady(very),noun(nondistinct)]).
question('Where are the 2012 Olympics to take place', [noun(olympics),verb( are),  noun(london)]).
question('Who are the British favourites to medal in 2012',[adjective(british), noun(favourites), verb(include), noun(jess_ennis)]).

det(the).
det(a).

noun(kelly_homes).
noun(daley_thompson).
noun(alan_well).
noun(marc_spitz).
noun(eddie_the_eagle).
noun(greece).
noun(javelin).
noun(games). /*noun?*/
noun(london).
noun(olympics).
noun(jess_ennis).
noun(winner).
noun(record).
noun(favorites).
noun(nondistinct).

adj(two_time).
adj(single_time).
adj(gold_medalist).
adj(record).
adj(very).
adj(ancient).
adj(british).

adverb(really).

verb(was).
verb(all_time).
verb(record).
verb(are).
verb(include).

/*a sentence is made up of a nown phrase and a verb phrase */

sentence(Sentence,sentence(np(Noun_Phrase),vp(Verb_Phrase))):-
        /* so take a sentence (first arg) and parse it into a noun phrase and a verb phase */
np(Sentence,Noun_Phrase,Rem),
vp(Rem,Verb_Phrase).

/
np([X|T],np(det(X),NP2),Rem):-
        det(X),
        np2(T,NP2,Rem).
np(Sentence,Parse,Rem):- np2(Sentence,Parse,Rem).
np(Sentence,np(NP,PP),Rem):-
        np(Sentence,NP,Rem1),
        pp(Rem1,PP,Rem).
np2([H|T],np2(noun(H)),T):- noun(H).
np2([H|T],np2(adj(H),Rest),Rem):- adj(H),np2(T,Rest,Rem).  /* s
pp([H|T],pp(prep(H),Parse),Rem):-
        prep(H),
        np(T,Parse,Rem).

any help would be appreciated.
thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close