Intro
 
Lession 1
 
Lession 2
 
Lession 3
 
Lession 4
 
Lession 5
 
Lession 6
 
Lession 7
 
Lession 8
 
Lession 9
 
Lession 10
 
Lession 11
 
Lession 12
 
Lession 13
 
Lession 14
 
Lession 15
 
Lession 16
 
Lession 17
 
Lession 18
 
Contact
 
 

 
Home | Text version
 

Learn Definite Clause Grammars (DCG) with Toki Pona

Lession 17 - Parse Trees

Until now we can only check the grammar of a sentence. The answer is only "true" or "false". Now we would like to get the parse trees of a sentences. Keep in mind that most sentences in Toki Pona could have several pars trees, because of multiple meanings.

Simple Version

We have to add the code for the parse tree. To make it easy to see the differences we go back to the simple version of the first lesson and modify the code. We have to add a new arguments to each non-terminal to represent its structure. The structure of the subordinate phrases is passed to the parent phrase via the variables in the additional arguments. On this way we will get the parse tree.

sentence(sentence(NP,VP,Sep))                --> noun_phrase(NP), verb_phrase(VP), separator_sentence(Sep). 

noun_phrase(noun_phrase(N))                  --> pronoun_1person(N).                                        
noun_phrase(noun_phrase(N))                  --> pronoun_2person(N).                                        
noun_phrase(noun_phrase(N,Sep))              --> noun(N), separator_noun_phrase(Sep).                       

verb_phrase(verb_phrase(V))                  --> verb_transitive(V).                                        
verb_phrase(verb_phrase(Be,N))               --> verb_be(Be), noun(N).            % In Toki Pona is no verb "to be".

We need also to add extra arguments to the terminal symbols.

noun(noun(jan))                              --> [jan].      % person, people, human, being, somebody, anybody
noun(noun(moku))                             --> [moku].     % food, meal
noun(noun(pona))                             --> [pona].     % good, simplicity, positivity
noun(noun(suli))                             --> [suli].     % size
noun(noun(suno))                             --> [suno].     % sun, light
noun(noun(telo))                             --> [telo].     % water, liquid, juice, sauce

pronoun_1person(pronoun(mi))                 --> [mi].       % I, we
pronoun_2person(pronoun(sina))               --> [sina].     % you

separator_sentence(separator('.'))           --> ['.'].      % At the end of a sentence.
separator_noun_phrase(separator(li))         --> [li].       % between any subject except mi and sina and its verb

verb_transitive(verb_transitive(jan))        --> [jan].      % to personify, to humanize, to personalize
verb_transitive(verb_transitive(moku))       --> [moku].     % to eat, to drink, to swallow, to ingest, to consume
verb_transitive(verb_transitive(pona))       --> [pona].     % to improve, to fix, to repair, to make good
verb_transitive(verb_transitive(suli))       --> [suli].     % to enlarge, to lengthen
verb_transitive(verb_transitive(telo))       --> [telo].     % to water, to wash with water

verb_be(verb_be(''))                         --> [].         % In toki pona is no verb "to be".

Actually we need no information about the separators for the parse tree. But it cannot hurt either.

To avoid confusing it will be better to have information about the place of the nonexistent "be". These two lines make the hidden "be" visible in the parse tree.

verb_phrase(verb_phrase(Be,N))               --> verb_be(Be), noun(N).  
verb_be(verb_be(''))                         --> [].        

Now we can show the parse trees of simple sentences.

% "mi moku." has two different parse trees here (I eat. / I am food). In this lesson are no adverbs for a third version.
?- sentence(Parse_tree, [mi,moku,.], []).
Parse_tree = sentence(noun_phrase(pronoun(mi)), verb_phrase(verb_transitive(moku)), separator('.')) ;
Parse_tree = sentence(noun_phrase(pronoun(mi)), verb_phrase(verb_be(''), noun(moku)), separator('.')) ;

?- sentence(Parse_tree, [jan,li,moku,.], []).
Parse_tree = sentence(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_transitive(moku)), separator('.')) ;
Parse_tree = sentence(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_be(''), noun(moku)), separator('.')) ;

Maybe you will ask why the same Toki Pona word is an argument for the terminal symbols. You can type different words also. Here an example for a simple translator.

noun(noun(people))                              --> [jan].      % person, people, human, being, somebody, anybody
noun(noun(food))                                --> [moku].     % food, meal
noun(noun(good))                                --> [pona].     % good, simplicity, positivity
noun(noun(big))                                 --> [suli].     % size
noun(noun(sun))                                 --> [suno].     % sun, light
noun(noun(water))                               --> [telo].     % water, liquid, juice, sauce

pronoun_1person(pronoun('I'))                   --> [mi].       % I, we
pronoun_2person(pronoun(you))                   --> [sina].     % you

separator_sentence(separator('.'))              --> ['.'].      % At the end of a sentence.
separator_noun_phrase(separator(''))            --> [li].       % between any subject except mi and sina and its verb

verb_transitive(verb_transitive(personify))     --> [jan].      % to personify, to humanize, to personalize
verb_transitive(verb_transitive(eat))           --> [moku].     % to eat, to drink, to swallow, to ingest, to consume
verb_transitive(verb_transitive(repair))        --> [pona].     % to improve, to fix, to repair, to make good
verb_transitive(verb_transitive(enlarge))       --> [suli].     % to enlarge, to lengthen
verb_transitive(verb_transitive(wash))          --> [telo].     % to water, to wash with water

verb_be(verb_be(be))                            --> [].         % In Toki Pona is no verb "to be".

And here parse trees.

?- sentence(Parse_tree, [jan,li,moku,.], []).
Parse_tree = sentence(noun_phrase(noun(people), separator('')), verb_phrase(verb_transitive(eat)), separator('.')) ;
Parse_tree = sentence(noun_phrase(noun(people), separator('')), verb_phrase(verb_be(be), noun(food)), separator('.')) ;

Here is the source code of toki-pona-17-simple.pro.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Learn Definite Clause Grammars with Toki Pona
% Toki Pona - Lession 17 - Basic Sentences - Simple variant 
% Parse Trees
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
% ['toki-pona-17-simple.pro'].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Grammar 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

sentence(sentence(NP,VP,Sep))                --> noun_phrase(NP), verb_phrase(VP), separator_sentence(Sep). % A sentence consist of a noun phrase, a verb phrase and a ".".

noun_phrase(noun_phrase(N))                  --> pronoun_1person(N).                                        % A noun phrase can be the pronoun "mi"      or
noun_phrase(noun_phrase(N))                  --> pronoun_2person(N).                                        % the pronoun "sina"                         or
noun_phrase(noun_phrase(N,Sep))              --> noun(N), separator_noun_phrase(Sep).                       % a noun plus "li".

verb_phrase(verb_phrase(V))                  --> verb_transitive(V).                                        % A verb phrase can be a transitive verb     or  
verb_phrase(verb_phrase(Be,N))               --> verb_be(Be), noun(N).                                      % In toki pona is no verb "to be".


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Words 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

noun(noun(jan))                              --> [jan].      % person, people, human, being, somebody, anybody
noun(noun(moku))                             --> [moku].     % food, meal
noun(noun(pona))                             --> [pona].     % good, simplicity, positivity
noun(noun(suli))                             --> [suli].     % size
noun(noun(suno))                             --> [suno].     % sun, light
noun(noun(telo))                             --> [telo].     % water, liquid, juice, sauce

pronoun_1person(pronoun(mi))                 --> [mi].       % I, we
pronoun_2person(pronoun(sina))               --> [sina].     % you

separator_sentence(separator('.'))           --> ['.'].      % At the end of a sentence.
separator_noun_phrase(separator(li))         --> [li].       % between any subject except mi and sina and its verb

verb_transitive(verb_transitive(jan))        --> [jan].      % to personify, to humanize, to personalize
verb_transitive(verb_transitive(moku))       --> [moku].     % to eat, to drink, to swallow, to ingest, to consume
verb_transitive(verb_transitive(pona))       --> [pona].     % to improve, to fix, to repair, to make good
verb_transitive(verb_transitive(suli))       --> [suli].     % to enlarge, to lengthen
verb_transitive(verb_transitive(telo))       --> [telo].     % to water, to wash with water

verb_be(verb_be(''))                         --> [].         % In Toki Pona is no verb "to be".


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*
Possible queries
The strange syntax is a result of the Difference List of Prolog
----------------

% "mi moku." has two different parse trees here (I eat. / I am food.).
?- sentence(Parse_tree, [mi,moku,.], []).
Parse_tree = sentence(noun_phrase(pronoun(mi)), verb_phrase(verb_transitive(moku)), separator('.')) ;
Parse_tree = sentence(noun_phrase(pronoun(mi)), verb_phrase(verb_be(''), noun(moku)), separator('.')) ;


--------------------------------

% List the structure:
?- listing.

*/

A Better Version

Now we change the other script of the first lesson. The sentences definition are very similar to the simple version.

sentence(sentence(SD,Sep))                            --> sentence_declarative(SD), separator(Sep,'.').    
sentence_declarative(sentence_declarative(NP,VP))     --> noun_phrase(NP), verb_phrase(VP).             

In difference to the simple version we have to handle two arguments for the terminal symbols.

noun_phrase(noun_phrase(NP))              --> pronoun(NP,mi).                                % A noun phrase can be the pronoun "mi"      or
noun_phrase(noun_phrase(NP))              --> pronoun(NP,sina).                              % the pronoun "sina"                         or
noun_phrase(noun_phrase(NP,Sep))          --> noun(NP,_),  separator(Sep,li).                % a noun plus "li".

verb_phrase(verb_phrase(V))               --> verb_transitive(V,_).                          % A verb phrase can be a transitive verb     or  
verb_phrase(verb_phrase(Be,N))            --> verb_be(Be), noun(N,_).                        % In toki pona is no verb "to be".

As an example here th changing for the nouns.

noun(noun(Noun),Noun) --> [Noun], { member(Noun, [   
...

We have to add an argument for "check_grammar".

% check_grammar             :- read_line(CL), wordlist(WL,CL,[]), !, sentence(WL,[]).   
  check_grammar(P)          :- read_line(CL), wordlist(WL,CL,[]), !, sentence(P,WL,[]). 

"check_grammar" return the parse trees now.

?- check_grammar(Parse_tree).
|: jan li moku.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_transitive(moku))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_be(''), noun(moku))), separator('.')) ;

Here is the source code of toki-pona-17.pro.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Learn Definite Clause Grammars with Toki Pona
% Toki Pona - Lession 01 - Basic Sentences - Parse Trees
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
% ['toki-pona-17.pro'].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Grammar 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sentence types:

% sentence((SD,Sep))         --> sentence_declarative(SD), separator(Sep,'.').       % A declarative sentence states a fact or an argument and ends with a full stop.
sentence((SD,Sep))         --> sentence_declarative(SD), separator(Sep,'.').       % A declarative sentence states a fact or an argument and ends with a full stop.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% definitions of the sentence types:

sentence_declarative(sentence_declarative(NP,VP))     --> noun_phrase(NP), verb_phrase(VP).                   % A declarative sentence consist of a noun phrase and a verb phrase.  


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% phrases:

noun_phrase(noun_phrase(NP))              --> pronoun(NP,mi).                                % A noun phrase can be the pronoun "mi"      or
noun_phrase(noun_phrase(NP))              --> pronoun(NP,sina).                              % the pronoun "sina"                         or
noun_phrase(noun_phrase(NP,Sep))          --> noun(NP,_),  separator(Sep,li).                % a noun plus "li".

verb_phrase(verb_phrase(V))               --> verb_transitive(V,_).                          % A verb phrase can be a transitive verb     or  
verb_phrase(verb_phrase(Be,N))            --> verb_be(Be), noun(N,_).                        % In toki pona is no verb "to be".


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Words 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

noun(noun(Noun),Noun) --> [Noun], { member(Noun, [   
     jan,            % person, people, human, being, somebody, anybody
     moku,           % food, meal
     pona,           % good, simplicity, positivity
     suli,           % size
     suno,           % sun, light
     telo            % water, liquid, juice, sauce
 ])
}.

pronoun(pronoun(Pronoun),Pronoun) --> [Pronoun], { member(Pronoun, [
     mi,            % I, we (pronoun 1. person)
     sina           % you (pronoun 2. person)
 ])
}.

separator(separator(Separator),Separator) --> [Separator], { member(Separator, [
     li,            % between any subject except mi and sina and its verb
     '.'            % At the end of a sentence.
 ])
}.

verb_transitive(verb_transitive(Verb_transitive),Verb_transitive) --> [Verb_transitive], { member(Verb_transitive, [
     jan,           % personify, humanize, personalize
     moku,          % eat, drink, swallow, ingest, consume
     pona,          % improve, fix, repair, make good
     suli,          % enlarge, lengthen
     suno,          % to light, to illumine
     telo           % water, wash with water
 ])
}.


verb_be(verb_be(''))                         --> [].         % In Toki Pona is no verb "to be".



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For a user friendly input:

% This syntax is pure Prolog:

% check_grammar             :- read_line(CL), wordlist(WL,CL,[]), !, sentence(WL,[]).   % Read a line from the user, put it in a list of words and check it with "sentence".
check_grammar(P)             :- read_line(CL), wordlist(WL,CL,[]), !, sentence(P,WL,[]).   % Read a line from the user, put it in a list of words and check it with "sentence".

read_line(WL)             :- get0(C), codelist(C,WL).                           % Read a character code and put it in a list of codes.

codelist(10,[])           :- !.                                                 % Stop to build the list after line feed (10).
codelist(13,[])           :- !.                                                 % Stop to build the list after carriage return (13).
codelist(33,[32,33,32|X]) :- get0(C2), codelist(C2,X).                          % Put spaces (32) arround the "!" (33) and continue to build the list.
codelist(44,[32,44,32|X]) :- get0(C2), codelist(C2,X).                          % Put spaces (32) arround the "," (44) and continue to build the list.
codelist(46,[32,46,32|X]) :- get0(C2), codelist(C2,X).                          % Put spaces (32) arround the "." (46) and continue to build the list.
codelist(58,[32,58,32|X]) :- get0(C2), codelist(C2,X).                          % Put spaces (32) arround the ":" (58) and continue to build the list.
codelist(59,[32,59,32|X]) :- get0(C2), codelist(C2,X).                          % Put spaces (32) arround the ";" (59) and continue to build the list.
codelist(63,[32,63,32|X]) :- get0(C2), codelist(C2,X).                          % Put spaces (32) arround the "?" (63) and continue to build the list.
codelist(C,[C|X])         :- get0(C2), codelist(C2,X).                          % Continue to build the list of codes with the next character code.

% The rest is in dcg syntax:

wordlist([X|Y])          --> word(X), whitespaces, wordlist(Y).                 % A wordlist could be bild of one word, whitespaces and an other wordlist.
wordlist([X])            --> whitespaces, wordlist(X).                          % A wordlist could be bild of whitespaces and the same wordlist.
wordlist([X])            --> word(X).                                           % A wordlist could be bild of one word.
wordlist([X])            --> word(X), whitespaces.                              % A wordlist could be bild of one word and whitespaces character.

word(W)                  --> charlist(X), {name(W,X)}.                          % Build a word from a list of character codes. 
                                                                                %  The prolog built-in predicate "name" represent a list of character codes as Atomic.
charlist([X|Y])          --> chr(X), charlist(Y).                               % A list of characters could be bild of one character and and an other list of characters.
charlist([X])            --> chr(X).                                            % A list of characters could be bild of one character.

chr(X)                   --> [X],{X>=33}.                                       % A useful character code for words is greater than or equal 33.  

whitespaces              --> whitespace, whitespaces.                           % A whitspace could be one and omore whitspaces.
whitespaces              --> whitespace.                                        % A whitspace could be one whitspace

whitespace               --> [X], {X<33}.                                       % A useful character code for whitespaces is less than 33.  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Possible queries
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Simple sentences with right grammar:
% Instead of "?- sentence([mi,moku,'.'],[])." you can use "check_grammar(Parse_tree)." 
% But "check_grammar(Parse_tree)." does not work in ​http://swish.swi-prolog.org. 
% If you use http://swish.swi-prolog.org please use "?- sentence([mi,moku,'.'],[]).".


% For example the sentence "mi moku" has two possibilities (I eat. / I am food.).
?- check_grammar(Parse_tree).
|: mi moku.
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(mi)), verb_phrase(verb_transitive(moku))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(mi)), verb_phrase(verb_be(''), noun(moku))), separator('.')) ;

% The sentence "sina pona." has two meanings as well.
?- check_grammar(Parse_tree).
|: sina pona.
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(sina)), verb_phrase(verb_transitive(pona))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(sina)), verb_phrase(verb_be(''), noun(pona))), separator('.')) ;

% More sentences with right grammar:
?- check_grammar(Parse_tree).
|: mi pona.
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(mi)), verb_phrase(verb_transitive(pona))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(mi)), verb_phrase(verb_be(''), noun(pona))), separator('.')) ;

?- check_grammar(Parse_tree).
|: telo li pona.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(telo), separator(li)), verb_phrase(verb_transitive(pona))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(telo), separator(li)), verb_phrase(verb_be(''), noun(pona))), separator('.')) ;

?- check_grammar(Parse_tree).
|: suno li suli.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(suno), separator(li)), verb_phrase(verb_transitive(suli))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(suno), separator(li)), verb_phrase(verb_be(''), noun(suli))), separator('.')) ;

?- check_grammar(Parse_tree).
|: moku li pona.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(moku), separator(li)), verb_phrase(verb_transitive(pona))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(moku), separator(li)), verb_phrase(verb_be(''), noun(pona))), separator('.')) ;

?- check_grammar(Parse_tree).
|: mi suli.
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(mi)), verb_phrase(verb_transitive(suli))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(mi)), verb_phrase(verb_be(''), noun(suli))), separator('.')) ;

?- check_grammar(Parse_tree).
|: jan li moku.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_transitive(moku))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_be(''), noun(moku))), separator('.')) ;

?- check_grammar(Parse_tree).
|: jan li pona.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_transitive(pona))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_be(''), noun(pona))), separator('.')) ;

?- check_grammar(Parse_tree).
|: sina suli.
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(sina)), verb_phrase(verb_transitive(suli))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(pronoun(sina)), verb_phrase(verb_be(''), noun(suli))), separator('.')) ;

?- check_grammar(Parse_tree).
|: telo li pona.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(telo), separator(li)), verb_phrase(verb_transitive(pona))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(telo), separator(li)), verb_phrase(verb_be(''), noun(pona))), separator('.')) ;

?- check_grammar(Parse_tree).
|: telo li suli.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(telo), separator(li)), verb_phrase(verb_transitive(suli))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(telo), separator(li)), verb_phrase(verb_be(''), noun(suli))), separator('.')) ;

?- check_grammar(Parse_tree).
|: suno li suli.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(suno), separator(li)), verb_phrase(verb_transitive(suli))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(suno), separator(li)), verb_phrase(verb_be(''), noun(suli))), separator('.')) ;

?- check_grammar(Parse_tree).
|: jan li moku.
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_transitive(moku))), separator('.')) ;
Parse_tree = sentence(sentence_declarative(noun_phrase(noun(jan), separator(li)), verb_phrase(verb_be(''), noun(moku))), separator('.')) ;


% Sentences with wrong grammar:
?- check_grammar(Parse_tree).
|: suno suli.
false

?- check_grammar(Parse_tree).
|: mi li suli.
false

?- check_grammar(Parse_tree).
|: li telo.
false

?- check_grammar(Parse_tree).
|: moku jan.
false

*/

 


rowa.giso.de | contact | Berlin (Good Old Europe)
This unofficial fan site by Robert Warnke is based on the official Toki Pona book and website: tokipona.org