Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:dcg_number_agreement [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Dcg number agreement ======
 +{{tag>​DCG}}
 +===== Description =====
 +A DCG with subject/​object number agreement
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{dcg_number_agreement.pl}}
 +===== Listing =====
 +<code prolog>
 +        sentence(sentence(NP,​VP)) -->
 +            noun_phrase(NP,​Num),​ verb_phrase(VP,​Num).
 +
 +        noun_phrase(np(D,​N),​Num) -->
 +            determiner(D,​Num),​ noun_phrase2(N,​Num).
 +        noun_phrase(np(N),​Num) --> noun_phrase2(N,​Num).
 +
 +        noun_phrase2(np2(A,​N),​Num) -->
 +            adjective(A),​ noun_phrase2(N,​Num).
 +        noun_phrase2(np2(N),​Num) --> noun(N,​Num).
 +
 +        verb_phrase(vp(V),​Num) --> verb(V,​Num).
 +        verb_phrase(vp(V,​N),​Num) -->
 +            verb(V,​Num),​ noun_phrase(N,​Num1).
 +
 +%       ​Vocabulary
 +
 +        determiner(det(the),​Num) --> [the].
 +        determiner(det(a),​singular) --> [a].
 +
 +        noun(noun(pieplate),​singular) --> [pieplate].
 +        noun(noun(pieplates),​plural) --> [pieplates].
 +        noun(noun(surprise),​singular) --> [surprise].
 +        noun(noun(surprises),​plural) --> [surprises].
 +
 +        adjective(adj(decorated)) --> [decorated].
 +
 +        verb(verb(contains),​singular) --> [contains].
 +        verb(verb(contain),​plural) --> [contain].
 +
 +%     ​Program 19.8:  A DCG with subject/​object number agreement
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/dcg_number_agreement.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0