Beginner's Question 
Author Message
 Beginner's Question

Hello,

   I am learning Prolog and working through some parsing examples at the
same time.  I am working on a Prolog example but having problems, I'm
hoping that someone can help.  

   The example is a chart parser.  The 'rule' rule accepts a part of speech
and tries to match that part of speech with the a matching part of speech
at the beginning of the tail of the grammar rules.  For example:

part of speech to match: np

'rule' should match s ---> np, vp.
or xxx ---> np, yyy.

Here is the code below:

?-op(1010,xfx,--->).
%
s ---> np, vp.
np ---> det, nb.

np ---> [kim].
det ---> [a].
tv ---> [ate].

word(Category,Word) :-            % This rule works great for matching words
        (Category ---> [Word]).        % against the appropriate part of speech.

rule(Category, [Word]) :-         % This rule fails to match.
        use_rule,                 % I don't understand why?
        (Category ---> [Word]).

use_rule.

Thanks for the help!!!!

[======================================================================]
[     Jeff A. Griffin      |__/~~~~~~~\__/~~~~~~\__/~~~~~~\__/~~~~~~\__|
[      Georgia Tech        |_____/~\_____/~\_______/~\_______/~\_______|
[   Research Institute     |____ /~\_____/~~~~\____/~~~~\____/~~~~\____|

[ ACME Standard Disclaimer |__/~~~~\_____/~~~~~~\__/~\_______/~\_______|
[======================================================================]



Tue, 15 Aug 1995 06:24:20 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Sorry it's beginner's question..

2. Data Type Problem - COM Beginner's question

3. Beginner's question

4. A Beginner's questions

5. A Beginner's questions - THANK YOU

6. Beginner's question

7. Beginner's Question -

8. Beginner's question on AWK

9. How to convert a string into a class (Beginner's question)

10. beginner's question, differences among Smalltalk implementations

11. Beginner's Question - Random Numbers

12. Beginner's Question: What is Eiffel?

 

 
Powered by phpBB® Forum Software