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 18 - Parse Trees

Now we use the scripts toki-pona-16.pro and the include files and add new arguments to each non-terminal to represent its structure. This is a really stupid job.

The Main Programm

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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Learn Definite Clause Grammars with toki pona
% toki pona - Lession 18 - Parse Trees	
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
% ['toki-pona-18.pro'].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Grammar  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sentence types:

sentence((S,Sep))  --> sentence_declarative(S),                          separator(Sep,'.').   % A declarative sentence states a fact or an argument and ends with a full stop.
sentence((S,Sep))  --> sentence_exclamatory(S),                          separator(Sep,'!').   % An exclamatory sentence makes also conveys excitement and ends with an exclamation mark.
sentence((S,Sep))  --> sentence_imperative(S),    (separator(Sep,'!') ;  separator(Sep,'.')).  % An imperative sentence (command) can ends with an exclamation mark or a full stop.
sentence((S,Sep))  --> sentence_interrogative(S),                        separator(Sep,'?').   % An interrogative sentence (questions) always ends in a question mark.
sentence((S))      --> headline(S).                                                            % A headline (title) is mostly not a complete sentence and has no punctuation mark. 


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

sentence_declarative(sentence_declarative(C,L,S))           --> conjunctions(C), la_phrases(L),      sentence_simple(S).                                                               % A declarative sentence can build of optional "la"-phrases and a simple sentence.
sentence_declarative(sentence_declarative(C,S,L))           --> conjunctions(C), sentence_simple(S), la_phrase_follow(L).                                                              % A declarative sentence can build of a simple sentence and optional "la"-phrases.
sentence_declarative(sentence_declarative(C,L1,S,Sep,L2,S)) --> conjunctions(C), la_phrases(L1),     sentence_simple(S),  separator(Sep,':'),  la_phrases(L2),  sentence_simple(S).    % A declarative sentence can build of two simple sentences separated by a colon with optional "la"-phrases.
sentence_declarative(sentence_declarative(A))               --> answer_yes(A).                                                                                                         % A declarative sentence can be a yes answer.
sentence_declarative(sentence_declarative(A))               --> answer_no(A).                                                                                                          % A declarative sentence can be a no answer.
sentence_declarative(sentence_declarative(C,V))             --> conjunctions(C), vocativ(V).                                                                                           % A declarative sentence can be a vocativ sentence (addressing people).
sentence_declarative(sentence_declarative(S))               --> salutation(S).                                                                                                         % A declarative sentence can be a salutation.
sentence_declarative(sentence_declarative(C,I))             --> conjunctions(C), interjection(I).                                                                                      % A declarative sentence can be an interjection.
sentence_declarative(sentence_declarative(C,V))             --> conjunctions(C), vocativ_interjection(V).                                                                              % A declarative sentence can be an interjection and vocativ sentence.
sentence_declarative(sentence_declarative(C,D))             --> conjunctions(C), designate(D).                                                                                         % A declarative sentence can be an special sentence for designate, for example: nimi mi li Lope.

sentence_exclamatory(sentence_exclamatory(S,IO))            --> sentence_declarative(S), interjection_optional(IO).                                                                    % A exclamatory sentence can has the same structure as an declarative sentence.

sentence_imperative(sentence_imperative(C,L,I,IO))            --> conjunctions(C), la_phrases(L),                                                              imperative(I),      interjection_optional(IO). % An imperative sentence (command). Optional: ... la ...o, ... .
sentence_imperative(sentence_imperative(C,I,L,IO))            --> conjunctions(C),                  imperative(I),    la_phrase_follow(L),                                         interjection_optional(IO). % An imperative sentence (command). Optional: ... la ...o, ... .
sentence_imperative(sentence_imperative(C,L1,S,Sep,L2,I,IO))  --> conjunctions(C), la_phrases(L1),  sentence_simple(S),  separator(Sep,':'),  la_phrases(L2),  imperative(I),      interjection_optional(IO).
sentence_imperative(sentence_imperative(C,L1,I,Sep,L2,S,IO))  --> conjunctions(C), la_phrases(L1),  imperative(I),       separator(Sep,':'),  la_phrases(L2),  sentence_simple(S), interjection_optional(IO). 
sentence_imperative(sentence_imperative(C,L1,I,Sep,L2,I,IO))  --> conjunctions(C), la_phrases(L1),  imperative(I),       separator(Sep,':'),  la_phrases(L2),  imperative(I),      interjection_optional(IO).
sentence_imperative(sentence_imperative(C,V,IO))              --> conjunctions(C), vocativ_imperative(V),                                                                          interjection_optional(IO). % An imperative sentence (command) can be a vocativ imperativ.

sentence_interrogative(sentence_interrogative(C,L,Q,IO))             --> conjunctions(C), la_phrases(L),                                                              question(Q),        interjection_optional(IO). % An interrogative sentence (question) can be a question. Optional with "la" phrase.
sentence_interrogative(sentence_interrogative(C,L1,S,Sep,L2,Q,IO))   --> conjunctions(C), la_phrases(L1),  sentence_simple(S),  separator(Sep,':'),  la_phrases(L2),  question(Q),        interjection_optional(IO).
sentence_interrogative(sentence_interrogative(C,L1,Q,Sep,L2,S,IO))   --> conjunctions(C), la_phrases(L1),  question(Q),         separator(Sep,':'),  la_phrases(L2),  sentence_simple(S), interjection_optional(IO). 
sentence_interrogative(sentence_interrogative(C,L1,Q1,Sep,L2,Q2,IO)) --> conjunctions(C), la_phrases(L1),  question(Q1),        separator(Sep,':'),  la_phrases(L2),  question(Q2),       interjection_optional(IO). % two questions ??
sentence_interrogative(sentence_interrogative(C,LQ,S,IO))            --> conjunctions(C), la_phrases_question(LQ),              sentence_simple(S),                                       interjection_optional(IO). % A question as "la" phrase.
sentence_interrogative(sentence_interrogative(C,VQ,IO))              --> conjunctions(C), vocativ_question(VQ),                                                                           interjection_optional(IO). % An interrogative sentence (question) can be a vocativ question.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% special sentences:

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

answer_yes(answer_yes(VT))               -->                       verb_transitive(VT,_).
answer_yes(answer_yes(VP,VT))            --> verb_pre(VP,Vpre),         verb_transitive(VT,V), {V\=Vpre}.
answer_yes(answer_yes(VP))               --> verb_pre(VP,_).

answer_no(answer_no(N))                  -->                                                    noun(N,ala).
answer_no(answer_no(VT,ADV))             -->                       verb_transitive(VT,_),       adverb(ADV,ala).
answer_no(answer_no(VP,ADV,VT))          --> verb_pre(VP,Vpre),                                 adverb(ADV,ala),  verb_transitive(VT,V), {V\=Vpre}.
answer_no(answer_no(VP,ADV))             --> verb_pre(VP,_),                                    adverb(ADV,ala).

vocativ(vocativ(SU,Sep))                                    --> subject(SU),                                        separator(Sep,o).
vocativ(vocativ(SU,Sep1,Sep2,NP,VP))                        --> subject(SU),                                        separator(Sep1,o), separator(Sep2,','), noun_phrase(NP), verb_phrases(VP).
vocativ_interjection(vocativ_interjection(SU,Sep1,Sep2,VP)) --> subject(SU),                                        separator(Sep1,o), separator(Sep2,','),                  verb_phrases(VP).

interjection(interjection(IW))                    --> interjection_word(IW,_).
interjection(interjection(IW1,IW2,IW3))           --> interjection_word(IW1,a), interjection_word(IW2,a), interjection_word(IW3,a).                                                                        % "a a a." laughing
interjection(interjection(NCP,Sep,IW))            --> noun_compound_person(NCP),                                separator(Sep,o),                                           interjection_word(IW,a).       % Addressing people really emotional.
interjection(interjection(L,S,IW))                --> la_phrases(L),            sentence_simple(S),                                                                         interjection_word(IW,a).       % A interjection sentence can build of an optional "la"-phrase, a simple sentence and an "a"..
interjection(interjection(L1,S1,Sep,L2,S2,IW))    --> la_phrases(L1),           sentence_simple(S1),            separator(Sep,':'),  la_phrases(L2),  sentence_simple(S2),  interjection_word(IW,a).       % A interjection sentence can build of two simple sentences with optional "la" phrases separated by a colon and followed by an "a".
interjection(interjection(L,NPI,VP))              --> la_phrases(L),            noun_phrase_interjection(NPI),  verb_phrases(VP).                                                                          % A interjection sentence consist of an optional "la"-phrase interjection, a noun phrase and verb phrases. 
interjection(interjection(NC,IW))                 --> noun_compound(NC),                                                                                                     interjection_word(IW,a).

salutation(salutation(N,ADJ))            --> noun(N,suno),                       adjectiv(ADJ,pona).                                                 % Salutation: "Good day!"
salutation(salutation(N,ADJ))            --> noun(N,lape),                       adjectiv(ADJ,pona).                                                 % Salutation: "Sleep well!"
salutation(salutation(N,ADJ))            --> noun(N,moku),                       adjectiv(ADJ,pona).                                                 % Salutation: "Enjoy your meal!"
salutation(salutation(N,ADJ))            --> noun(N,tawa),                       adjectiv(ADJ,pona).                                                 % Salutation: "Good bye!"
salutation(salutation(N,ADJ))            --> noun(N,kama),                       adjectiv(ADJ,pona).                                                 % Salutation: "Welcome!"
salutation(salutation(N,ADJ))            --> noun(N,musi),                       adjectiv(ADJ,pona).                                                 % Salutation: "Have fun!"
salutation(salutation(PN,VI))            --> pronoun(PN,mi),                     verb_intransitive(VI,tawa).                                         % Salutation: "Good bye!" (I go)   
salutation(salutation(PN,ADJ,VI))        --> pronoun(PN,mi), adjectiv(ADJ,mute), verb_intransitive(VI,tawa).                                         % Salutation: "Good bye!" (we go) 
salutation(salutation(N,PRE;PN))         --> noun(N,pona),                       preposition(PRE,tawa), pronoun(PN,sina).                            % Salutation: "Peace be with you."
salutation(salutation(N,ADJ))            --> noun(N,pona),                       adjectiv(ADJ,mute).                                                 % Salutation: "Very good!"
salutation(salutation(N,ADJ1,ADJ2))      --> noun(N,pona),                       adjectiv(ADJ1,mute), adjectiv(ADJ2,mute).                           % Salutation: "Very, very good!"
salutation(salutation(N,ADJ1,ADJ2,ADJ3)) --> noun(N,pona),                       adjectiv(ADJ1,mute), adjectiv(ADJ2,mute), adjectiv(ADJ3,mute).      % Salutation: "Excellent!"

imperative(imperative(Sep,VP))                     --> separator(Sep,o),           verb_phrases(VP).                                                               % An imperative starts with an "o" as a noun phrase.
imperative(imperative(Sep,VP1,Sep,NP,VP2))         --> separator(Sep,o),           verb_phrases(VP1),   separator(Sep,':'),   noun_phrase(NP),  verb_phrases(VP2).
vocativ_imperative(vocativ_imperative(PNC,Sep,VP)) --> pronoun_compound(PNC),      separator(Sep,o),                   verb_phrases(VP).                           % An vocative imperative sentence has an "o" instead of a "li".
vocativ_imperative(vocativ_imperative(NC,Sep,VP))  --> noun_compound(NC),          separator(Sep,o),                   verb_phrases(VP).

designate(designate(N,PN,Sep,ADJ))                  --> noun(N,nimi),                                                               pronoun(PN,_), separator(Sep,li),  female_prominent_personage(ADJ,_).       % Normally unofficial word need a noun before because there are adjectives.
designate(designate(N,PN,Sep,ADJ))                  --> noun(N,nimi),                                                               pronoun(PN,_), separator(Sep,li),  male_prominent_personage(ADJ,_).         % But in Toki Pona is no word for "be" and adjectives can be after "li".
designate(designate(N,PN,Sep,ADJ))                  --> noun(N,nimi),                                                               pronoun(PN,_), separator(Sep,li),  female_name(ADJ,_).
designate(designate(N,PN,Sep,ADJ))                  --> noun(N,nimi),                                                               pronoun(PN,_), separator(Sep,li),  male_name(ADJ,_).
designate(designate(N1,Sep1,N2,PN,Sep2,ADJ))        --> noun(N1,nimi), separator(Sep1,pi), noun(N2,ma),                             pronoun(PN,_), separator(Sep2,li), continent(ADJ,_).
designate(designate(N1,Sep1,N2,ADJ1,PN,Sep2,ADJ2))  --> noun(N1,nimi), separator(Sep1,pi), noun(N2,ma),      adjectiv(ADJ1,suli),   pronoun(PN,_), separator(Sep2,li), continent(ADJ2,_).
designate(designate(N1,Sep1,N2,PN,Sep2,ADJ))        --> noun(N1,nimi), separator(Sep1,pi), noun(N2,ma),                             pronoun(PN,_), separator(Sep2,li), country(ADJ,_).
designate(designate(N1,Sep1,N2,ADJ1,PN,Sep2,ADJ2))  --> noun(N1,nimi), separator(Sep1,pi), noun(N2,ma),      adjectiv(ADJ1,tomo),   pronoun(PN,_), separator(Sep2,li), city(ADJ2,_).
designate(designate(N1,Sep1,N2,PN,Sep2,ADJ))        --> noun(N1,nimi), separator(Sep1,pi), noun(N2,toki),                           pronoun(PN,_), separator(Sep2,li), language(ADJ,_).
designate(designate(N1,Sep1,N2,ADJ1,PN,Sep2,ADJ2))  --> noun(N1,nimi), separator(Sep1,pi), noun(N2,toki),    adjectiv(ADJ1,luka),   pronoun(PN,_), separator(Sep2,li), sign_language(ADJ2,_).
designate(designate(N1,Sep1,N2,ADJ1,PN,Sep2,ADJ2))  --> noun(N1,nimi), separator(Sep1,pi), noun(N2,nasin),   adjectiv(ADJ1,sewi),   pronoun(PN,_), separator(Sep2,li), ideology(ADJ2,_).
designate(designate(N1,Sep1,N2,ADJ1,PN,Sep2,ADJ2))  --> noun(N1,nimi), separator(Sep1,pi), noun(N2,nasin),   adjectiv(ADJ1,pona),   pronoun(PN,_), separator(Sep2,li), ideology(ADJ2,_).
designate(designate(N1,Sep1,N2,PN,Sep2,ADJ2))       --> noun(N1,nimi), separator(Sep1,pi), noun(N2,kulupu),                         pronoun(PN,_), separator(Sep2,li), community(ADJ2,_).
designate(designate(N1,Sep1,N2,ADJ1,PN,Sep2,ADJ2))  --> noun(N1,nimi), separator(Sep1,pi), noun(N2,sitelen), adjectiv(ADJ1,tawa),   pronoun(PN,_), separator(Sep2,li), movies(ADJ2,_).
designate(designate(N1,Sep1,N2,ADJ1,PN,Sep2,ADJ2))  --> noun(N1,nimi), separator(Sep1,pi), noun(N2,_),       adjectives_pure(ADJ1), pronoun(PN,_), separator(Sep2,li), unofficial_words_miscellaneous(ADJ2,_).

vocativ_question(vocativ_question(NC,Sep1,Sep2,Q))  --> noun_compound(NC),                              separator(Sep1,o), separator(Sep2,','), question(Q).                         % Addressing and asking.    

question(question(Q))    --> question_yes_no(Q).                                                                                            % A question can be a yes/no question.
question(question(Q))    --> question_pardon(Q).                                                                                            % Pardon? = seme?
question(question(Q))    --> question_what_subject(Q).
question(question(Q))    --> question_what_object_d(Q).                                                                                     % What direct object
question(question(Q))    --> question_what_object_i(Q).                                                                                     % What intransitives object
question(question(Q))    --> question_what_object_p(Q).                                                                                     % What prepositional object
question(question(Q))    --> question_when(Q).
question(question(Q))    --> question_what_is_object(Q).                                                                                    % In toki pona is no verb "to be". 
question(question(Q))    --> question_what_verb(Q).                                                                                 
question(question(Q))    --> question_where(Q).
question(question(Q))    --> question_wherefrom(Q).
question(question(Q))    --> question_whereto(Q).
question(question(Q))    --> question_who(Q).
question(question(Q))    --> question_whom(Q).
question(question(Q))    --> question_which_subject(Q).
question(question(Q))    --> question_which_object_d(Q).
question(question(Q))    --> question_which_object_i(Q).
question(question(Q))    --> question_which_object_p(Q).
question(question(Q))    --> question_why(Q).
question(question(Q))    --> question_how(Q).
question(question(Q))    --> question_or_what(Q).                                                                                           % ... anu seme? - Not a real question. It is more an imperativ.
question(question(Q))    --> question_decision_s(Q).
question(question(Q))    --> question_decision_v(Q).
question(question(Q))    --> question_how_many(Q).

question_yes_no(question_yes_no(NP,QYNVP))   --> noun_phrase(NP), question_yn_verb_phrase(QYNVP).                                                                       % A Yes/No questions consist of a noun phrase and a special verb phrase.

question_pardon(question_pardon(QW))          --> question_word(QW,seme).

question_what_subject(question_what_subject(QW,Sep,VP))    --> question_word(QW,seme),                         separator(Sep,li),                    verb_phrases(VP).

question_what_object_d(question_what_object_d(NP,VTC,Sep,QW))   --> noun_phrase(NP),                           verb_transitive_compound(VTC),                                 separator(Sep,e),                     question_word(QW,seme).
question_what_object_i(question_what_object_i(NP,VTC,QW))       --> noun_phrase(NP),                           verb_intransitive_compound(VTC),                                                                 question_word(QW,seme).
question_what_object_p(question_what_object_p(NP,VTC,Prep,QW))  --> noun_phrase(NP),                           verb_transitive_compound(VTC),                                 preposition(Prep,P), {P\=lon,P\=tan},  question_word(QW,seme). % lon is for where-questions. tan is for why- and wherefrom-questions.

question_what_is_object(question_what_is_object(NP,NC,QW))  --> noun_phrase(NP),                                                                                           noun_compound(NC),                    question_word(QW,seme). % In toki pona is no verb "to be". 

question_what_verb(question_what_verb(NP,QW,DO))       --> noun_phrase(NP),  question_word(QW,seme),           direct_objects(DO).                                                                                                  % Is seme a transitive verb?
question_what_verb(question_what_verb(NP,QW,IO))       --> noun_phrase(NP),  question_word(QW,seme),           intrans_objects(IO).                                                                                                 % Is seme a intransitive verb?
question_what_verb(question_what_verb(NP,QW,PO))       --> noun_phrase(NP),  question_word(QW,seme),           prepositional_objects(PO).

question_where(question_where(NP,Prep,NSO,QW))         --> noun_phrase(NP),                                 preposition(Prep,lon),        noun_spatial_optional(NSO),                                             question_word(QW,seme).
question_where(question_where(NP,VP,Prep,NSO,QW))      --> noun_phrase(NP),          verb_phrases(VP),      preposition(Prep,lon),        noun_spatial_optional(NSO),                                             question_word(QW,seme).

question_wherefrom(question_wherefrom(NP,VT,Prep,NC,QW)) --> noun_phrase(NP),  verb_transitive(VT,kama),         preposition(Prep,tan),                           noun_compound(NC),                              question_word(QW,seme).

question_whereto(question_whereto(NP,VP,Prep,NSO,QW))  --> noun_phrase(NP),          verb_phrases(VP),          preposition(Prep,tawa),       noun_spatial_optional(NSO),                                  question_word(QW,seme).   

question_who(question_who(N,QW,NPG,Sep,VP))            --> noun(N,jan),         question_word(QW,seme),   noun_pi_groups(NPG),     separator(Sep,li),   verb_phrases(VP).
question_who(question_who(N,QW,NPG,Sep,VP))            --> noun(N,meli),        question_word(QW,seme),   noun_pi_groups(NPG),     separator(Sep,li),   verb_phrases(VP).
question_who(question_who(N,QW,NPG,Sep,VP))            --> noun(N,mije),        question_word(QW,seme),   noun_pi_groups(NPG),     separator(Sep,li),   verb_phrases(VP).

question_whom(question_whom(NP,VP,Sep,N,ADJ,QW))       --> noun_phrase(NP),     verb_phrases(VP),      separator(Sep,e),     noun(N,jan),       adjectives(ADJ),   question_word(QW,seme).
question_whom(question_whom(NP,VP,Sep,N,ADJ,QW))       --> noun_phrase(NP),     verb_phrases(VP),      separator(Sep,e),     noun(N,meli),      adjectives(ADJ),   question_word(QW,seme).
question_whom(question_whom(NP,VP,Sep,N,ADJ,QW))       --> noun_phrase(NP),     verb_phrases(VP),      separator(Sep,e),     noun(N,mije),      adjectives(ADJ),   question_word(QW,seme).
question_whom(question_whom(NP,VP,Pre,N,ADJ,QW))       --> noun_phrase(NP),     verb_phrases(VP),      preposition(Pre,_),   noun(N,jan),       adjectives(ADJ),   question_word(QW,seme).
question_whom(question_whom(NP,VP,Pre,N,ADJ,QW))       --> noun_phrase(NP),     verb_phrases(VP),      preposition(Pre,_),   noun(N,meli),      adjectives(ADJ),   question_word(QW,seme).
question_whom(question_whom(NP,VP,Pre,N,ADJ,QW))       --> noun_phrase(NP),     verb_phrases(VP),      preposition(Pre,_),   noun(N,mije),      adjectives(ADJ),   question_word(QW,seme).

question_which_subject(question_which_subject(SU,QW,Sep,VP))   --> subject(SU), question_word(QW,seme),                separator(Sep,li),                      verb_phrases(VP).

question_which_object_d(question_which_object_d(NP,VTC,Sep,No,ADJ,QW))  --> noun_phrase(NP),   verb_transitive_compound(VTC),      separator(Sep,e),                      noun(No,N), {N\=jan,N\=meli,N\=mije,N\=tan,N\=tenpo}, adjectives(ADJ), question_word(QW,seme).
question_which_object_i(question_which_object_i(NP,VIC,No,ADJ,QW))      --> noun_phrase(NP),   verb_intransitive_compound(VIC),                                           noun(No,N), {N\=jan,N\=meli,N\=mije,N\=tan,N\=tenpo}, adjectives(ADJ), question_word(QW,seme).
question_which_object_p(question_which_object_p(NP,VTC,Pre,No,ADJ,QW))  --> noun_phrase(NP),   verb_transitive_compound(VTC),      preposition(Pre,P), {P\=lon,P\=tan},   noun(No,N), {N\=jan,N\=meli,N\=mije,N\=tan,N\=tenpo}, adjectives(ADJ), question_word(QW,seme).

question_when(question_when(NP,VP,Pre,N,QW))   --> noun_phrase(NP),   verb_phrases(VP),         preposition(Pre,lon),   noun(N,tenpo),       question_word(QW,seme).                                        % mama sina li kama lon tenpo seme?
question_when(question_when(NP,QW,Sep,NP,VP))  --> noun(NP,tenpo),    question_word(QW,seme),   separator(Sep,la),      noun_phrase(NP),     verb_phrases(VP).                                              % tenpo seme la mama sina li kama?

question_why(question_why(NP,VP,N,QW))       --> noun_phrase(NP), verb_phrases(VP),        noun(N,tan),    question_word(QW,seme).
question_why(question_why(N,QW,Sep,NP,VP))   --> noun(N,tan),   question_word(QW,seme),   separator(Sep,la), noun_phrase(NP),  verb_phrases(VP).                                                             % tan seme la soweli wawa pimeja li moku e ona?

question_how(question_how(NP,VP,Pre,N,QW))   --> noun_phrase(NP), verb_phrases(VP), preposition(Pre,kepeken), noun(N,nasin),  question_word(QW,seme).

question_or_what(question_or_what(NP,VP,Con,QW)) --> noun_phrase(NP), verb_phrases(VP),   conjunction(Con,anu),       question_word(QW,seme).

question_decision_s(question_decision_s(SU1,Con,SU2,Sep,VP)) --> subject(SU1),                          conjunction(Con,anu),       subject(SU2),              separator(Sep,li),  verb_phrases(VP).
question_decision_v(question_decision_v(NP,VP,Con,VP))       --> noun_phrase(NP), verb_phrases(VP),             conjunction(Con,anu),                                             verb_phrases(VP).

question_how_many(question_how_many(SU,Sep1,N,QW,Sep2,NP,VP))  --> subject(SU),      separator(Sep1,pi),  noun(N,mute),    question_word(QW,seme),   separator(Sep2,la) ,       noun_phrase(NP),    verb_phrases(VP).                                            % tenpo pi mute seme la sina sike e suno?  (How old are you?)
question_how_many(question_how_many(SU,Sep1,N,QW,Sep2,VP))     --> subject(SU),      separator(Sep1,pi),  noun(N,mute),    question_word(QW,seme),   separator(Sep2,li),                            verb_phrases(VP).                                            % tomo pi mute seme li lon?
question_how_many(question_how_many(NP,VP,Sep1,NC,Sep2,N,QW))  --> noun_phrase(NP),  verb_phrases(VP),   separator(Sep1,e),  noun_compound(NC),      separator(Sep2,pi),  noun(N,mute),   question_word(QW,seme).                                               % jan Konan li moku e kili pi mute seme?
question_how_many(question_how_many(NP,VP,Sep,N,QW,PO))        --> noun_phrase(NP),  verb_phrases(VP),   separator(Sep,e),  noun(N,_), question_word(QW,seme),      prepositional_objects(PO).                         % sina wile e mani seme tan soweli ni?

headline(headline(SU))               --> subject(SU).
headline(headline(IO,PO))            --> intrans_objects(IO),  prepositional_objects(PO).


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

noun_phrase(noun_phrase(PN))                --> pronoun_no_li(PN).
noun_phrase(noun_phrase(PN,Con,SU,SUA,Sep)) --> pronoun_no_li(PN),             conjunction(Con,en), subject(SU), subject_add(SUA),   separator(Sep,li).
noun_phrase(noun_phrase(PN,SUA,Sep))        --> pronoun_with_li(PN),           subject_add(SUA),                             separator(Sep,li).
noun_phrase(noun_phrase(NC,SUA,Sep))        --> noun_compound(NC),             subject_add(SUA),                             separator(Sep,li).

noun_phrase_interjection(noun_phrase_interjection(PN,IW))                --> pronoun_no_li(PN),                                                                  interjection_word(IW,a).
noun_phrase_interjection(noun_phrase_interjection(PN,Con,SU,SUA,IW,Sep)) --> pronoun_no_li(PN),             conjunction(Con,en), subject(SU), subject_add(SUA),  interjection_word(IW,a),  separator(Sep,li).
noun_phrase_interjection(noun_phrase_interjection(PN,SUA,IW,Sep))        --> pronoun_with_li(PN),           subject_add(SUA),                                    interjection_word(IW,a),  separator(Sep,li).
noun_phrase_interjection(noun_phrase_interjection(NC,SUA,IW,Sep))        --> noun_compound(NC),             subject_add(SUA),                                    interjection_word(IW,a),  separator(Sep,li).

subject(subject(PNC,SUA))    --> pronoun_compound(PNC),       subject_add(SUA).
subject(subject(NC,SUA))     --> noun_compound(NC),           subject_add(SUA).

subject_add([])                 --> [].                                                                                                        % Combine (pro)nouns with "en".
subject_add(subject_add(Con,SU,SUA)) --> conjunction(Con,en), subject(SU), subject_add(SUA).

verb_phrases(verb_phrases(VP,VPA))  --> verb_phrase(VP),         verb_phrase_add(VPA).

verb_phrase(verb_phrase(VTC,DO,PO))     --> verb_transitive_compound(VTC),                                  direct_objects(DO),   prepositional_objects(PO).
verb_phrase(verb_phrase(VIC,IO,PO))     --> verb_intransitive_compound(VIC),                                intrans_objects(IO),  prepositional_objects(PO).
verb_phrase(verb_phrase(Be,ADJO,ADJ))   --> verb_be(Be), adjectives_at_least_one(ADJO),   adjectives(ADJ).                                                     % In toki pona is no verb "to be". 
verb_phrase(verb_phrase(Be,PNC))        --> verb_be(Be), pronoun_compound(PNC).                                                                                % In toki pona is no verb "to be".
verb_phrase(verb_phrase(Be,NC))         --> verb_be(Be), noun_compound(NC).                                                                                    % In toki pona is no verb "to be". 

verb_phrase_add([])          --> [].
verb_phrase_add(verb_phrase_add(CO,Sep,VP,VPA))          --> comma_optional(CO),            separator(Sep,li),       verb_phrase(VP),          verb_phrase_add(VPA).

question_yn_verb_phrase(question_yn_verb_phrase(VT1,ADV,VT2,DO,PO))    -->                                                      verb_transitive(VT1,Verb),   adverb(ADV,ala), verb_transitive(VT2,Verb),   direct_objects(DO), prepositional_objects(PO).
question_yn_verb_phrase(question_yn_verb_phrase(VP1,ADV,VP2,VT,DO,PO)) --> verb_pre(VP1,Verb_pre), adverb(ADV,ala), verb_pre(VP2,Verb_pre), verb_transitive(VT,Verb), { Verb \= Verb_pre },                direct_objects(DO), prepositional_objects(PO).
question_yn_verb_phrase(question_yn_verb_phrase(VP1,ADV,VP2,DO,PO))    --> verb_pre(VP1,Verb_pre), adverb(ADV,ala), verb_pre(VP2,Verb_pre),                                                                direct_objects(DO), prepositional_objects(PO).
question_yn_verb_phrase(question_yn_verb_phrase(VI1,ADV,VI2,IO))       -->                                                      verb_intransitive(VI1,Verb), adverb(ADV,ala), verb_intransitive(VI2,Verb),  intrans_objects(IO).
question_yn_verb_phrase(question_yn_verb_phrase(VP1,ADV,VP2,VT,IO))    --> verb_pre(VP1,Verb_pre), adverb(ADV,ala), verb_pre(VP2,Verb_pre), verb_intransitive(VT,Verb), { Verb \= Verb_pre },               intrans_objects(IO).

la_phrases([])                                          --> [].                                                                                               % no "la" phrase
la_phrases(la_phrases(LP))                              --> la_phrase(LP). 
la_phrases(la_phrases(LP1,LP2))                         --> la_phrase(LP1), la_phrase(LP2).
la_phrase(la_phrase(NC,CO1,Sep,CO2))                    --> noun_compound(NC),                                comma_optional(CO1),    separator(Sep,la),      comma_optional(CO2).    % ...     la (,)
la_phrase(la_phrase(NP,VP,CO1,Sep,CO2))                 --> noun_phrase(NP),        verb_phrases(VP),         comma_optional(CO1),    separator(Sep,la),      comma_optional(CO2).    % ... (,) la (,)
la_phrase_follow(la_phrase_follow(CO1,Sep,CO2,NC))      --> comma_optional(CO1),    separator(Sep,la),        comma_optional(CO2),    noun_compound(NC).                              % la phrase at the end of a sentences.
la_phrases_question(la_phrases_question(Q,CO1,Sep,CO2)) --> question(Q),            comma_optional(CO1),      separator(Sep,la),      comma_optional(CO2).                            % A question as a "la" phrase.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% objects:

direct_objects([])           --> [].                                                                                                        % no direct object
direct_objects(direct_objects(DO,DOs))      --> direct_object(DO),       direct_objects(DOs).   
direct_object(direct_object(Sep,NC,OOA))    --> separator(Sep,e),        noun_compound(NC),          object_optional_add(OOA). 
direct_object(direct_object(Sep,PC,OOA))    --> separator(Sep,e),        pronoun_compound(PC),       object_optional_add(OOA).

intrans_objects([])         --> [].      
intrans_objects(intrans_objects(IO))         --> intrans_object(IO).
intrans_object(intrans_object(NC,OOA))       --> noun_compound(NC),                                object_optional_add(OOA).                 
intrans_object(intrans_object(PC,OOA))       --> pronoun_compound(PC),                              object_optional_add(OOA).                  

prepositional_objects([])   --> [].                       
prepositional_objects(prepositional_objects(PO,POs))   --> prepositional_object(PO), prepositional_objects(POs).
prepositional_object(prepositional_object(Pre,NC,OOA))    --> preposition(Pre,_),       noun_compound(NC),          object_optional_add(OOA).
prepositional_object(prepositional_object(Pre,PC,OOA))    --> preposition(Pre,_),       pronoun_compound(PC),       object_optional_add(OOA).

object_optional_add([])     --> [].
object_optional_add(object_optional_add(Con,NC))     --> conjunction(Con,anu),     noun_compound(NC).                                                                        % "mi kute e mije anu meli." pu page 64
object_optional_add(object_optional_add(Con,PC))     --> conjunction(Con,anu),     pronoun_compound(PC).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pronouns:

pronoun_optional([])                           --> [].
pronoun_optional(pronoun_optional(PN))     --> pronoun(PN,_).
pronoun_no_li(pronoun_no_li(PN))           --> pronoun(PN,mi).                                                                       % "mi" or "sina" need no "li".
pronoun_no_li(pronoun_no_li(PN))           --> pronoun(PN,sina).                                                                     % "mi" or "sina" need no "li".
pronoun_with_li(pronoun_with_li(PN))       --> pronoun(PN,P), {P\=mi,P\=sina}.                                                       % These pronouns need a "li".
pronoun_with_li(pronoun_with_li(PN,ADJ))   --> pronoun(PN,_),                               adjectiv(ADJ,mute).                      % These compund pronouns need a "li".
pronoun_compound(pronoun_compound(PN,ADJ)) --> pronoun(PN,_),                               adjectives(ADJ).                         % All (compound) pronouns.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% nouns:

noun_compound(noun_compound(NC,NPG))    --> noun_compound_geography(NC),                      noun_pi_groups(NPG).                                            % The special rules have to be before the general rules.
noun_compound(noun_compound(NC,NPG))    --> noun_compound_language(NC),                       noun_pi_groups(NPG).
noun_compound(noun_compound(NC,NPG))    --> noun_compound_ideology(NC),                       noun_pi_groups(NPG).
noun_compound(noun_compound(NC,NPG))    --> noun_compound_person(NC),                         noun_pi_groups(NPG).
noun_compound(noun_compound(NC,NPG))    --> noun_compound_community(NC),                      noun_pi_groups(NPG).
noun_compound(noun_compound(NC,NPG))    --> noun_compound_movie(NC),                          noun_pi_groups(NPG).
noun_compound(noun_compound(N,ADJ,NPG)) --> noun(N,_),                  adjectives(ADJ),      noun_pi_groups(NPG).                                            % A compound noun can be build with a noun and optional adjectives and optional "pi" and a second noun group. 

noun_pi_groups([])          --> [].                                                                                                      % A noun can have no pi-phrase
noun_pi_groups(noun_pi_groups(NPG))             --> noun_pi_group(NPG).
noun_pi_groups(noun_pi_groups(NPG1,NPG2))       --> noun_pi_group(NPG1),  noun_pi_group(NPG2).
noun_pi_groups(noun_pi_groups(NPG1,NPG2;NPG3))  --> noun_pi_group(NPG1),  noun_pi_group(NPG2),  noun_pi_group(NPG3).                 % A noun can have up to three pi-phrase 

noun_pi_group(noun_pi_group(Sep,N,AAO,ADJ,NSGA))   --> separator(Sep,pi),  noun(N,_),                   adjectives_at_least_one(AAO),       adjectives(ADJ),                 noun_second_group_add(NSGA).    % after "pi" have to be at least two words.
noun_pi_group(noun_pi_group(Sep,N,ADJ,PN,NSGA))    --> separator(Sep,pi),  noun(N,_),                                                       adjectives(ADJ), pronoun(PN,_),  noun_second_group_add(NSGA).    
noun_pi_group(noun_pi_group(Sep,PN,AAO,ADJ,NSGA))  --> separator(Sep,pi),  pronoun(PN,_),               adjectives_at_least_one(AAO),       adjectives(ADJ),                 noun_second_group_add(NSGA). 
noun_pi_group(noun_pi_group(Sep,PN,AAO,ADJ,NSGA))  --> separator(Sep,pi),  pronoun(PN,_),               adjectives_at_least_one(AAO),       adjectives(ADJ),                 noun_second_group_add(NSGA). 
noun_pi_group(noun_pi_group(Sep,NC,NSGA))          --> separator(Sep,pi),  noun_compound_geography(NC),                                                 noun_second_group_add(NSGA).
noun_pi_group(noun_pi_group(Sep,NC,NSGA))          --> separator(Sep,pi),  noun_compound_language(NC),                                                  noun_second_group_add(NSGA).
noun_pi_group(noun_pi_group(Sep,NC,NSGA))          --> separator(Sep,pi),  noun_compound_ideology(NC),                                                  noun_second_group_add(NSGA).
noun_pi_group(noun_pi_group(Sep,NC,NSGA))          --> separator(Sep,pi),  noun_compound_person(NC),                                                    noun_second_group_add(NSGA).
noun_pi_group(noun_pi_group(Sep,NC,NSGA))          --> separator(Sep,pi),  noun_compound_community(NC),                                                 noun_second_group_add(NSGA).
noun_pi_group(noun_pi_group(Sep,N,Con,NC,NSGA))    --> separator(Sep,pi),  noun(N,_),                  conjunction(Con,en),  noun_compound(NC),         noun_second_group_add(NSGA).    % after "pi" have to be at least two words.
noun_pi_group(noun_pi_group(Sep,N,Con,PC,NSGA))    --> separator(Sep,pi),  noun(N,_),                  conjunction(Con,en),  pronoun_compound(PC),      noun_second_group_add(NSGA).    % after "pi" have to be at least two words.
noun_pi_group(noun_pi_group(Sep,PN,Con,NC,NSGA))   --> separator(Sep,pi),  pronoun(PN,_),              conjunction(Con,en),  noun_compound(NC),         noun_second_group_add(NSGA).    % after "pi" have to be at least two words.
noun_pi_group(noun_pi_group(Sep,PN,Con,PC,NSGA))   --> separator(Sep,pi),  pronoun(PN,_),              conjunction(Con,en),  pronoun_compound(PC),      noun_second_group_add(NSGA).    % after "pi" have to be at least two words.

noun_second_group_add([])   --> [].                                                                                                                % Combine (pro)nouns with "en".
noun_second_group_add(noun_second_group_add(Con,PC,NSGA))  --> conjunction(Con,en), pronoun_compound(PC), noun_second_group_add(NSGA).
noun_second_group_add(noun_second_group_add(Con,NC,NSGA))  --> conjunction(Con,en), noun_compound(NC),    noun_second_group_add(NSGA).

noun_compound_geography(noun_compound_geography(N,ION,ADJS))     --> noun(N,ma),                         continent(ION,_),       adjectives(ADJS).
noun_compound_geography(noun_compound_geography(N,ADJ,ION,ADJS)) --> noun(N,ma),    adjectiv(ADJ,suli),  continent(ION,_),       adjectives(ADJS).
noun_compound_geography(noun_compound_geography(N,ION,ADJS))     --> noun(N,ma),                         country(ION,_),         adjectives(ADJS).
noun_compound_geography(noun_compound_geography(N,ADJ,ION,ADJS)) --> noun(N,ma),    adjectiv(ADJ,tomo),  city(ION,_),            adjectives(ADJS).
noun_compound_language(noun_compound_geography(N,ION,ADJS))      --> noun(N,toki),                       language(ION,_),        adjectives(ADJS).
noun_compound_language(noun_compound_geography(N,ADJ,ION,ADJS))  --> noun(N,toki),  adjectiv(ADJ,luka),  sign_language(ION,_),   adjectives(ADJS).                       % sign language (luka = hand)
noun_compound_ideology(noun_compound_geography(N,ADJ,ION,ADJS))  --> noun(N,nasin), adjectiv(ADJ,sewi),  ideology(ION,_),        adjectives(ADJS).
noun_compound_ideology(noun_compound_geography(N,ADJ,ION,ADJS))  --> noun(N,nasin), adjectiv(ADJ,pona),  ideology(ION,_),        adjectives(ADJS).
noun_compound_community(noun_compound_geography(N,ION,ADJS))     --> noun(N,kulupu),                     community(ION,_),       adjectives(ADJS).   

noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,jan),                    resident(ION,_),                    adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,jan),                    female_prominent_personage(ION,_),  adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,jan),                    male_prominent_personage(ION,_),    adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,jan),                    female_name(ION,_),                 adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,jan),                    male_name(ION,_),                   adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,meli),                   resident(ION,_),                    adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,meli),                   female_prominent_personage(ION,_),  adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,meli),                   female_name(ION,_),                 adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,mije),                   resident(ION,_),                    adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,mije),                   male_prominent_personage(ION,_),    adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ION,ADJS))   --> noun(N,mije),                   male_name(ION,_),                   adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ADJS))       --> noun(N,jan),                                                        adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ADJS))       --> noun(N,meli),                                                       adjectives(ADJS).
noun_compound_person(noun_compound_person(N,ADJS))       --> noun(N,mije),                                                       adjectives(ADJS).

noun_compound_movie(noun_compound_movie(N,ADJ,ION,ADJS)) --> noun(N,sitelen), adjectiv(ADJ,tawa), movies(ION,_),                 adjectives(ADJS).

noun_spatial_optional([])  --> [].
noun_spatial_optional(noun_spatial_optional(N))  --> noun(N,anpa).
noun_spatial_optional(noun_spatial_optional(N))  --> noun(N,insa).
noun_spatial_optional(noun_spatial_optional(N))  --> noun(N,monsi).
noun_spatial_optional(noun_spatial_optional(N))  --> noun(N,noka).
noun_spatial_optional(noun_spatial_optional(N))  --> noun(N,poka).
noun_spatial_optional(noun_spatial_optional(N))  --> noun(N,sewi).
noun_spatial_optional(noun_spatial_optional(N))  --> noun(N,sinpin).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% verbs:

verb_transitive_compound(verb_transitive_compound(VPO,ADV1,VT,ADV2))     --> verb_pre_optional(VPO),   adverbs(ADV1),   verb_transitive(VT,_),      adverbs(ADV2).

verb_intransitive_compound(verb_intransitive_compound(VPO,ADV1,VI,ADV2)) --> verb_pre_optional(VPO),   adverbs(ADV1),   verb_intransitive(VI,_),    adverbs(ADV2).

verb_pre_optional([])          --> [].
verb_pre_optional(verb_pre_optional(VP))          --> verb_pre(VP,_).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% adjectives:

adjectives(adjectives(ADJp,PNo1,NUMo,PNo2,ADJf))    --> adjectives_pure(ADJp),     pronoun_optional(PNo1),                  numbers_optional(NUMo),        pronoun_optional(PNo2),   adjective_final(ADJf).
adjectives(adjectives(ADJp,IOW,NUMo,PNo2,ADJf))     --> adjectives_pure(ADJp),     unofficial_words_miscellaneous(IOW,_),   numbers_optional(NUMo),        pronoun_optional(PNo2),   adjective_final(ADJf).

adjectives_pure([])         --> [].                                                                                                    % no adjectiv
adjectives_pure(adjectives_pure(ADJ))               --> adjectiv(ADJ,_).                                                               % only one adjectiv
adjectives_pure(adjectives_pure(ADJ1,ADJ2))         --> adjectiv(ADJ1,A), adjectiv(ADJ2,B),                    {A\=B}.                 % two adjectives
adjectives_pure(adjectives_pure(ADJ1,ADJ2,ADJ3))    --> adjectiv(ADJ1,A), adjectiv(ADJ2,B), adjectiv(ADJ3,C),  {A\=B,A\=C,B\=C}.              

adjectives_at_least_one(adjectives_at_least_one(ADJ)) --> adjectiv(ADJ,_). 
adjectives_at_least_one(adjectives_at_least_one(NUM)) --> numeral(NUM,_).

adjective_final([])         --> [].
adjective_final(adjective_final(ADJ))         --> adjectiv(ADJ,taso).
adjective_final(adjective_final(ADJ))         --> adjectiv(ADJ,kin).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% adverbs:

adverbs([])                 --> [].                                                                                                                        % no adverb
adverbs(adverbs(ADV))                  --> adverb(ADV,_).                                                                                              % only one adverb
adverbs(adverbs(ADV1,ADV2))            --> adverb(ADV1,A),   adverb(ADV2,B),                                       {A\=B} .                            % several adverbs
adverbs(adverbs(ADV1,ADV2,ADV3))       --> adverb(ADV1,A),   adverb(ADV2,B),   adverb(ADV3,C),                     {A\=B,A\=C,B\=C} .              
adverbs(adverbs(ADV1,ADV2,ADV3,ADV4))  --> adverb(ADV1,A),   adverb(ADV2,B),   adverb(ADV3,C),   adverb(ADV4,D),   {A\=B,A\=C,A\=D,B\=C,B\=D,C\=D}.    % max. 4 different adverbs


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conjunctions:

conjunctions(A)         --> [], {A = ''}.
conjunctions(conjunctions(Con,CO))    --> conjunction(Con,_), comma_optional(CO).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% numbers:

numbers_optional([])        --> [].
numbers_optional(numbers_optional(NUMs))        --> numbers(NUMs).

numbers(numbers(NUMs))                 --> number_cardinal(NUMs).                                                                                            % 1,   2,   3, ...
numbers(numbers(NUMs))                 --> number_ordinal(NUMs).                                                                                             % 1th, 2th, 3th, ...

number_cardinal(number_cardinal(NUMs))         -->                     number(NUMs).                                                                                     % "normal" numbers
number_ordinal(number_ordinal(ADJ,NUMs))       --> adjectiv(ADJ,nanpa), number(NUMs).                                                                                    % Ordinal numbers have "nanpa" before the number.

number(number(NUM))     --> numeral(NUM,ala).                                                                                           %  0
number(number(NUM))     --> count_system_1_2_5(NUM).                                                                                    % "standard" count system with ala, wan, tu, luka 
number(number(NUM))     --> count_system_1_2(NUM).                                                                                      % old        count system with ala, wan ,tu
number(number(NUM))     --> count_system_pu(NUM).                                                                                       % pu         count system with ala, wan, tu, luka, mute, ali
number(number(NUM))     --> count_system_vague(NUM).                                                                                    % vague:     mute mute mute, lili lili lili

count_system_1_2_5(count_system_1_2_5(NMR))         --> numeral(NMR,wan).                                                               %  1                                  
count_system_1_2_5(count_system_1_2_5(NMR))         --> numeral(NMR,tu).                                                                %  2                                 
count_system_1_2_5(count_system_1_2_5(NMR1,NMR2))   --> numeral(NMR1,tu),   numeral(NMR2,wan).                                          %  3                 
count_system_1_2_5(count_system_1_2_5(NMR1,NMR2))   --> numeral(NMR1,tu),   numeral(NMR2,tu).                                           %  4                
count_system_1_2_5(count_system_1_2_5(NMR,RAD,DIG)) --> numeral(NMR,luka),  number_radix_5(RAD),  number_digits_5(DIG).                 %  5, ...
number_radix_5([])          --> []. 
number_radix_5(number_radix_5(NMR,RAD))  --> numeral(NMR,luka),  number_radix_5(RAD).                                                   % luka, luka, luka, ...
number_digits_5([])         --> [].                                                                                                         % + 0
number_digits_5(number_digits_5(NMR))         --> numeral(NMR,an).                                                                      % + 1
number_digits_5(number_digits_5(NMR))         --> numeral(NMR,tu).                                                                      % + 2
number_digits_5(number_digits_5(NMR1,NMR2))   --> numeral(NMR1,tu),    numeral(NMR2,wan).                                               % + 3
number_digits_5(number_digits_5(NMR1,NMR2))   --> numeral(NMR1,tu),    numeral(NMR2,tu).                                                % + 4

count_system_1_2(count_system_1_2(NMR1,NMR2,NMR3))         --> numeral(NMR1,tu),    numeral(NMR2,tu), numeral(NMR3,wan).                %  5 (We need not 1,2,3,4 because there are the same as in the other count systems.)
count_system_1_2(count_system_1_2(NMR1,NMR2,NMR3,RAD,DIG)) --> numeral(NMR1,tu),    numeral(NMR2,tu), numeral(NMR3,tu), number_radix_2(RAD), number_digits_2(DIG).        %  6 (tu tu tu), ...
number_radix_2([])          --> [].
number_radix_2(number_radix_2(NMR,RAD))          --> numeral(NMR,tu),    number_radix_2(RAD).                                           % tu, tu, tu, ...
number_digits_2([])         --> [].                                                                                                         % + 0
number_digits_2(number_digits_2(NMR))         --> numeral(NMR,wan).                                                                     % + 1

count_system_pu(count_system_pu(NMR))         --> numeral(NMR,mute).                                      
count_system_pu(count_system_pu(NMR,RAD,CS))  --> numeral(NMR,mute),  number_radix_20(RAD), count_system_1_2_5(CS).                     % Oh yes, I know it is ugly inaccurate.
count_system_pu(count_system_pu(NMR))         --> numeral(NMR,ale).
count_system_pu(count_system_pu(NMR,RAD1,RAD2,CS))  --> numeral(NMR,ale),   number_radix_100(RAD1), number_radix_20(RAD2), count_system_1_2_5(CS).        % Oh yes, I know it is ugly inaccurate as well.
number_radix_20([])         --> [].
number_radix_20(number_radix_20(NMR,RAD))         --> numeral(NMR,mute),  number_radix_20(RAD).                                         % mute, mute, mute, ...
number_radix_100([])        --> [].
number_radix_100(number_radix_100(NMR,RAD))        --> numeral(NMR,ale),   number_radix_100(RAD).                                       % ale, ale, ale, ...

count_system_vague(count_system_vague(ADJ))            --> adjectiv(ADJ,mute).                                                                                  % vague numbers
count_system_vague(count_system_vague(ADJ1,ADJ2))      --> adjectiv(ADJ1,mute),        adjectiv(ADJ2,kin).                                                      % mute kin
count_system_vague(count_system_vague(ADJ1,ADJ2))      --> adjectiv(ADJ1,mute),        adjectiv(ADJ2,mute).                                                     % mute mute
count_system_vague(count_system_vague(ADJ1,ADJ2,ADJ3)) --> adjectiv(ADJ1,mute),        adjectiv(ADJ2,mute),       adjectiv(ADJ3,mute).                          % mute mute mute
count_system_vague(count_system_vague(ADJ))            --> adjectiv(ADJ,lili).                                                                                  % lili
count_system_vague(count_system_vague(ADJ1,ADJ2))      --> adjectiv(ADJ1,lili),        adjectiv(ADJ2,kin).                                                      % lili kin
count_system_vague(count_system_vague(ADJ1,ADJ2))      --> adjectiv(ADJ1,lili),        adjectiv(ADJ2,lili).                                                     % lili lili
count_system_vague(count_system_vague(ADJ1,ADJ2,ADJ3)) --> adjectiv(ADJ1,lili),        adjectiv(ADJ2,lili),       adjectiv(ADJ3,lili).                          % lili lili lili
count_system_vague(count_system_vague(ADJ1,ADJ2))      --> adjectiv(ADJ1,mute),        adjectiv(ADJ2,lili).                                                     % mute lili
count_system_vague(count_system_vague(ADJ1,ADJ2))      --> adjectiv(ADJ1,ili),         adjectiv(ADJ2,mute).                                                     % lili mute


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% miscellaneous:

comma_optional([])         --> [].
comma_optional(comma_optional(Sep))         --> separator(Sep,',').

interjection_optional([])  --> [].
interjection_optional(interjection_optional(IW))  --> interjection_word(IW,a).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Official Words
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

adjectiv(adjectiv(Adjectiv),Adjectiv) --> [Adjectiv], { member(Adjectiv, [     
     akesi,        % amphibian-, reptilian-, slimy
     ala,          % no, not, none, un- 
     alasa,        % hunting-, -hunting, hunting ...
     ale,          % all, every, complete, whole  (ale = ali), (depreciated)
     ali,          % all, every, complete, whole  (ale = ali)
     ante,  	   % different, dissimilar, altered, changed, other, unequal, differential, variant
     awen,         % remaining, stationary, permanent, sedentary
     anpa,         % low, lower, bottom, down
     esun,         % marketable, for sale, salable, deductible
     ijo,          % of something
     ike,          % bad, negative, wrong, evil, overly complex, (figuratively) unhealthy
     insa,         % inner, internal
     jaki,         % dirty, gross, filthy, obscene
     jan,          % human, somebody's, personal, of people
     jelo,         % yellowish, yellowy
     jo,           % private, personal
     kala,         % fish-
     kalama,       % noisy
     kama,         % coming, future
     kasi,         % vegetable, vegetal, biological, biologic, leafy
     kili,         % fruity
     kin,          % indeed, still, too; in can be the very last word in an adjective group.
     kiwen,        % hard, solid, stone-like, made of stone or metal
     kon,          % air-like, ethereal, gaseous
     kule,         % colourful, pigmented, painted
     kulupu,       % communal, shared, public, of the society
     kute,         % auditory, hearing
     lape,         % sleeping, of sleep, dormant
     laso,         % bluish, bluey
     lawa,         % main, leading, in charge
     len,          % dressed, clothed, costumed, dressed up 
     lete,         % cold, cool, uncooked, raw, perishing
     lili,         % small, little, young, a bit, short, few, less
     linja,        % elongated, oblong, long
     lipu,         % book-, paper-, card-, ticket-, sheet-, page,-
     loje,         % reddish, ruddy, pink, pinkish, gingery
     lon,          % real, true, existing, correct, genuine
     luka,         % tactile
     lukin,        % visual(ly)
     ma,           % countrified, outdoor, alfresco, open-air
     mama,         % of the parent, parental, maternal, fatherly, maternal, motherly, mumsy
     mani,         % financial, financially, monetary, pecuniary
     meli,         % female, feminine, womanly
     mije,         % male, masculine, manly
     moku,         % eating
     moli,         % dead, dying, fatal, deadly, lethal, mortal, deathly, killing
     monsi,        % back, rear
     monsuta,      % fearful, afraid
     mu,           % animal nois-
     mun,          % lunar
     musi,         % artful, fun, recreational
     mute,         % many, very, much, several, a lot, abundant, numerous, more
     namako,       % spicy, piquant
     nanpa,        % ... th, To build ordinal numbers.
     nasa,         % silly, crazy, foolish, drunk, strange, stupid, weird
     nasin,        % systematic, habitual, customary, doctrinal, doctrinaire 
     nena,         % hilly, undulating, mountainous, hunchbacked, humpbacked, bumpy
     oko,          % optical, eye-
     olin,         % love
     open,         % initial, starting, opening
     pakala,       % destroyed, ruined, demolished, shattered, wrecked
     pali,         % active, work-related, operating, working
     pana,         % generous, radioactive, contagious
     pilin,        % sensitive, feeling, empathic
     pimeja,       % black, dark
     pini,         % ago, completed, ended, finished, past, done
     poka,         % neighbouring
     pona,         % good, simple, positive, nice, correct, right
     pu,           % buying and interacting with the official Toki Pona book
     sama,         % same, similar, equal, of equal status or position
     seli,         % hot, warm, cooked
     sewi,         % superior, elevated, religious, formal
     sijelo,       % physical, bodily, corporal, corporeal, material, carnal
     sinpin,       % facial, frontal, anterior
     sitelen,      % figurative, pictorial, metaphorical, metaphorisch
     sona,         % knowing, cognizant, shrewd
     soweli,       % animal
     suwi,         % sweet, cute
     sike,         % round, cyclical, of one year
     sin,          % new, fresh, another, more
     sinpin,       % vertical
     suli,         % big, tall, long, adult, important
     suno,         % sunny, sunnily
     supa,         % flat, shallow, flat-bottomed, horizontal
     tan,          % causal, 
     taso,         % only, sole
     tawa,         % moving, mobile
     telo,         % wett, slobbery, moist, damp, humid, sticky, sweaty, dewy, drizzly
     tenpo,        % temporal, chronological, chronologic
     toki,         % speaking, eloquent, linguistic, verbal, grammatical
     tomo,         % urban, domestic, household
     unpa,         % erotic, sexual
     uta,          % oral
     utala,        % fighting
     walo,         % white, whitish, light-coloured, pale
     waso,         % bird-
     wawa,         % energetic, strong, fierce, intense, sure, confident
     weka          % absent, away, ignored
%     wile          % necessary
 ])
}.

adverb(adverb(Adverb),Adverb) --> [Adverb], { member(Adverb, [
     ala,          % don't
     ale,          % always, forever, evermore, eternally (ale = ali), (depreciated)
     ali,          % always, forever, evermore, eternally (ale = ali)
     awen,         % still, yet
     ijo,          % of something
     ike,          % bad, negative, wrong, evil, overly complex, (figuratively) unhealthy
     jaki,         % dirty, gross, filthy
     jan,          % human, somebody's, personal, of people
     kama,         % coming, future
     kili,         % fruity
     kin,          % actually, indeed, in fact, really, objectively, as a matter of fact; kin can be the very last word in an adverb group.
     kiwen,        % hard, solid, stone-like, made of stone or metal
     kon,          % air-like, ethereal, gaseous
     lape,         % asleep
     lawa,         % main, leading, in charge
     lete,         % bleakly
     lili,         % small, little, young, a bit, short, few, less
     lukin,        % visual(ly)
     mani,         % financially
     moku,         % eating
     moli,         % mortally
     mu,           % animal nois-
     musi,         % cheerfully
     mute,         % many, very, much, several, a lot, abundant, numerous, more
     nasa,         % silly, crazy, foolish, drunk, strange, stupid, weird
     noka,         % on foot
     pakala,       % destroyed, ruined, demolished, shattered, wrecked
     pali,         % actively, briskly
     pilin,        % perceptively
     pona,         % good, simple, positive, nice, correct, right
     sama,         % just as, equally, exactly the same, just the same, similarly
     seli,         % hot, warm, cooked
     sewi,         % superior, elevated, religious, formal
     sijelo,       % physically, bodily
     sike,         % rotated
     sin,          % afresh, anew, in turn, 
     sitelen,      % pictorially
     suli,         % big, tall, long, adult, important
     suno,         % sunny, sunnily
     taso,         % only, just, merely, simply, solely, singly
     tawa,         % moving, mobile
     telo,         % wett, slobbery, moist, damp, humid, sticky, sweaty, dewy, drizzly
     tenpo,        % chronologically
     toki,         % speaking, eloquent, linguistic, verbal, grammatical
     tomo,         % urban, domestic, household
     unpa,         % erotic, sexual
     uta,          % orally
     utala,        % fighting
     wawa          % strongly, powerfully
%     wile          % necessary
 ])
}.

conjunction(conjunction(Conjunction),Conjunction) --> [Conjunction], { member(Conjunction, [
%     ante,         % otherwise, on the other hand 
     anu,          % or (used for decision questions)
     en,           % and (used to coordinate head nouns)
%     kin,          % moreover, in addition, likewise
%     ike,          % unfortunately
%     open,         % firstly, in the beginning 
%     pona,         % luckily
     taso          % but, however
 ])
}.

interjection_word(interjection_word(Interjection_word),Interjection_word) --> [Interjection_word], { member(Interjection_word, [
     a,            % ah, ha, uh, oh, ooh, aw, well (emotion word)
     ala,          % no!
     ike,          % oh dear! woe! alas!
     jaki,         % ew! yuck!
%     kin,          % really!
     mu,           % woof! meow! moo! etc. (cute animal noise)
     o,            % hey! (calling somebody's attention)
     pakala,       % damn! fuck!
     pona,         % great! good! thanks! OK! cool! yay!
     toki          % hello, hi, good morning,
 ])
}.

noun(noun(Noun),Noun) --> [Noun], { member(Noun, [  
     akesi,        % reptile, amphibian; non-cute animal
     ala,          % nothing, negation, zero
     alasa,        % hunting
     ale,          % everything, anything, life, the universe, (depreciated)
     ali,          % everything, anything, life, the universe
     ante,         % difference, distinction, differential, variation, variance, disagreement
     anpa,         % bottom, lower part, under, below, floor, beneath
     awen,         % inertia, continuity, continuum, stay
     esun,         % market, shop, fair, bazaar, business, transaction
     ijo,          % thing, something, stuff, anything, object
     ike,          % negativity, badness, evil
     ilo,          % tool, device, machine, thing used for a specific purpose
     insa,         % inside, inner world, centre, stomach
     jaki,         % dirt, pollution, garbage, filth, feces
     jan,          % person, people, human, being, somebody, anybody
     jelo,         % yellow, light green
     jo,           % having, possessions, content
     kala,         % fish, marine animal, sea creature
     kalama,       % sound, noise, voice
     kama,         % event, happening, chance, arrival, beginning
     kasi,         % plant, vegetation, herb, leaf
     ken,          % possibility, ability, power to do things, permission
     kili,         % fruit, pulpy vegetable, mushroom
     kipisi,       % section, fragment, slice
     kiwen,        % hard thing, rock, stone, metal, mineral, clay
     ko,           % semi-solid or squishy substance; clay, clinging form, dough, glue, paste, powder, gum
     kon,          % air, wind, smell, soul
     kule,         % color, colour, paint, ink, dye, hue
     kute,         % hearing, ear
     kulupu,       % group, community, society, company, people
     lape,         % sleep, rest
     laso,         % blue, blue-green
     lawa,         % head, mind
     len,          % clothing, cloth, fabric, network, internet
     lili,         % smallness, youth, immaturity
     lon,          % existence, being, presence
     lete,         % cold, chill, bleakness
     linja,        % long and flexible thing; string, rope, hair, thread, cord, chain, line, yarn
     lipu,         % paper, card, ticket, sheet, page, flat and bendable thing, book, webpage, blog, list
     loje,         % red
     luka,         % arm, hand, tacticle organ
     lukin,        % view, look, glance, sight, gaze, glimpse, seeing, vision, sight, attention 
     lupa,         % hole, orifice, door, window
     ma,           % land, earth, country, (outdoor) area
     mama,         % parent, mother, father
     mani,         % money, material wealth, currency, dollar, capital
     meli,         % woman, female, girl, wife, girlfriend
     mije,         % man, male, husband, boyfriend
     moku,         % food, meal
     moli,         % death, decease
     monsi,        % back, rear end, butt, behind
     monsuta,      % monster, monstrosity, fearful thing, fright, mythical creatures, fear
     mu,           % animal noise
     mun,          % moon, lunar, night sky object, star
     musi,         % fun, playing, game, recreation, art, entertainment
     mute,         % amount, quantity
     namako,       % spice, something extra, food additive, accessory
     nanpa,        % number
     nasa,         % stupidity, foolishness, silliness, nonsense, idiocy, inanity, obtuseness, ninny, muddler
     nasin,        % way, manner, custom, road, path, doctrine, system, method
     nena,         % bump, hill, extrusion, button, mountain, nose, protuberance
     nimi,         % word, name
     noka,         % leg, foot; organ of locomotion; bottom, lower part
     oko,          % eye
     olin,         % love
     open,         % start, beginning, opening 
     pakala,       % blunder, accident, mistake, destruction, damage, breaking
     pali,         % activity, work, deed, project
     palisa,       % long hard thing; branch, rod, stick, pointy thing
     pan,          % cereal, grain; barley, corn, oat, rice, wheat; bread, pasta
     pana,         % giving, transfer, exchange
     pilin,        % feelings, emotion, feel, think, sense, touch, heart (physical or emotional)
     pimeja,       % darkness, shadows
     pini,         % end, tip
     pipi,         % bug, insect, spider
     poka,         % side, hip, next to
     poki,         % container, box, bowl, cup, glass
     pona,         % good, simplicity, positivity
     pu,           % buying and interacting with the official Toki Pona book
     sama,         % equality, parity, equity, identity, par, sameness
     seli,         % fire, warmth, heat
     selo,         % skin, external surface of something, outer form, outer layer, outside, bark, peel, shell, skin, boundary, shape
     sewi,         % high, up, above, top, over, on
     sijelo,       % body (of person or animal), physical state, torso
     sike,         % circle, ball, cycle, sphere, wheel; round or circular thing
     sin,          % news, novelty, innovation, newness, new release
     sinpin,       % face, foremost, front, wall, chest, torso
     sitelen,      % picture, image, representation, symbol, mark, writing
     sona,         % knowledge, wisdom, intelligence, understanding
     soweli,       % animal, especially land mammal, lovable animal, beast
     suli,         % size
     suno,         % sun, light
     supa,         % horizontal surface, e.g furniture, table, chair, pillow, floor
     suwi,         % candy, sweet food
     tan,          % origin, cause
     tawa,         % movement, transportation
     telo,         % water, liquid, juice, sauce
     tenpo,        % time, period of time, moment, duration, situation, occasion
     toki,         % language, speech, tongue, lingo, jargon, 
     tomo,         % indoor constructed space, e.g. house, home, room, building
     tu,           % duo, pair
     unpa,         % sex, sexuality
     uta,          % mouth, lips, oral cavity, jaw, beak
     utala,        % conflict, disharmony, competition, fight, war, battle, attack, blow, argument, physical or verbal violence
     walo,         % white thing or part, whiteness, lightness
     wan,          % unit, element, particle, part, piece
     waso,         % bird, bat; flying creature, winged animal
     wawa,         % energy, strength, power
     weka,         % absence
     wile          % desire, need, will
 ])
}.

numeral(numeral(Numeral),Numeral) --> [Numeral], { member(Numeral, [ 
     ala,          %   0
     wan,          %   1
     tu,           %   2
     luka,         %   5
%     ten,         %  10 (suggestion of jan Lope)
     mute,         %  20 (official Toki Pona book)
     ale           % 100 (official Toki Pona book)
 ])
}.

preposition(preposition(Preposition),Preposition) --> [Preposition], { member(Preposition, [
     kepeken,      % with
     lon,          % be (located) in/at/on
     poka,         % in the accompaniment of, with
     sama,         % like, as, seem
     tan,          % from, by, because of, since
     tawa          % to, in order to, towards, for, until
 ])
}.

pronoun(pronoun(Pronoun),Pronoun) --> [Pronoun], { member(Pronoun, [
     mi,           % I, we (pronoun 1. person)
     sina,         % you (pronoun 2. person)
     ona,          % she, he, it, they (pronoun 3. person)
     ni            % this, that (pronoun determiner)
 ])
}.

question_word(question_word(Question_word),Question_word) --> [Question_word], { member(Question_word, [
	seme           % what, which, wh- (question word)
 ])
}.

separator(separator(Separator),Separator) --> [Separator], { member(Separator, [
     e,            % introduces a direct object
     la,           % between the context phrase and the main sentence
     li,           % between any subject except mi and sina and its verb
     o,            % O (vocative or imperative)
     pi,           % separates a noun from another noun that has at least one adjective
     '.',          % At the end of a sentence.
     '!',          % At the end of an interjection.
     '?',          % At the end of a question.
     ':',          % Between an hint sentences and a sentences.
     ',',          % comma
     '"'           % quotation mark
 ])
}.

verb_intransitive(verb_intransitive(Verb_intransitive),Verb_intransitive) --> [Verb_intransitive], { member(Verb_intransitive, [
     anpa,         % to prostrate oneself
     awen,         % to stay, to wait,to remain
     ike,          % to be bad, to suck
     kalama,       % to make noise
     kama,         % to come, to become, to arrive, to happen, manage to, start to
     kasi,         % to grow
     ken,          % can, is able to, is allowed to, may, is possible
     kepeken,      % to use
     kon,          % to breathe
     lape,         % to sleep, to rest
     lon,          % to be there, to be present, to be real/true, to exist, to be awake
     lukin,        % to look, to watch out, to pay attention
     moli,         % to die, to be dead
     musi,         % to play, to have fun
     pakala,       % to screw up, to fall apart, to break
     pali,         % to act, to work, to function
     pilin,        % to feel, to sense
     sewi,         % to get up 
     sona,         % to know, to understand
     tan,          % to come from, to originate from, to stem from, to be descended from, to emerge, to follow, to come out of
     tawa,         % go to, walk, travel, move, leave
     toki,         % to talk, to chat, to communicate
     unpa          % to have sex
 ])
}.

verb_transitive(verb_transitive(Verb_transitive),Verb_transitive) --> [Verb_transitive], { member(Verb_transitive, [
     alasa,        % to hunt, to forage
     anpa,         % to defeat, to beat, to vanquish, to conquer, to enslave
     ante,         % to change, to alter, to modify
     awen,         % to keep
     esun,         % to buy, to sell, to barter, to swap
     ijo,          % to objectify
%     ilo,          % to work on with tools, to work with machines
     ike,          % to make bad, to worsen, to have a negative effect upon
     jaki,         % to pollute, to dirty
     jan,          % to personify, to humanize, to personalize
%     jelo,         % to color yellow, to turn yellow
     jo,           % to have, to contain
     kalama,       % to sound, to ring, to play (an instrument)
     kama,         % to bring about, to summon
     kasi,         % to plant, to grow
     ken,          % to make possible, to enable, to allow, to permit
     kipisi,       % to cut
     kiwen,        % to solidify, to harden, to petrify, to fossilize
     ko,           % to squash, to pulverize
     kon,          % to blow away something, to puff away something
     kule,         % to paint, to color
     kulupu,       % to assemble, to call together, to convene
     kute,         % to hear, to listen,
     lape,         % to knock out
     lawa,         % to lead, to control, to rule, to steer
     len,          % to wear, to be dressed, to dress
     lete,         % to cool down, to chill
     lili,         % to reduce, to shorten, to shrink, to lessen
     lukin,        % to see, to look at, to watch, to read
     lupa,         % to pierce, to stab, to perforate 
     mama,         % to mother sb., to wet-nurse, mothering
     moku,         % to eat, to drink, to swallow, to ingest, to consume
     moli,         % to kill
     musi,         % to amuse, to entertain
     mute,         % to make many or much
     mu,           % to make animal nois
     namako,       % to spice, to flavor, to decorate
     nanpa,        % to count
     nasa,         % to drive crazy, to make weird
     nimi,         % to name
     olin,         % to love (a person)
     open,         % to open, to start, to begin, to turn on
     pakala,       % to screw up, to fuck up, to botch, to ruin, to break, to hurt, to injure, to damage, to spoil, to ruin
     pali,         % to do, to make, to build, to create
     palisa,       % to stretch, to beat, to poke, to stab, to poke, to prod, to sexually arouse
     pan,          % to sow
     pana,         % to give, to put, to send, to place, to release, to emit, to cause, to transmit
     pilin,        % to feel, to think, to sense, to touch, to handle, to finger, to fumble, to grope, to fiddle, to pet, to caress, to fondle
     pimeja,       % to darken
     pini,         % to end, to stop, to turn off, to finish, to close
     poki,         % to box up, to put in, to can
     pona,         % to improve, to fix, to repair, to make good
     sama,         % to equate, to make equal, to make similar to
     seli,         % to heat, to warm up, to cook
     selo,         % to shelter, to protect, to guard 
     sewi,         % to lift
     sike,         % to orbit, to circle, to revolve, to circle around, to rotate
     sin,          % to renew, to renovate, to freshen
     sijelo,       % to heal, to heal up, to cure
     sitelen,      % to draw, to write
     sona,         % to know, to understand, to know how to
     suli,         % to enlarge, to lengthen
     suno,         % to light, to illumine
%     supa,         % to bury 
     suwi,         % to sweeten
     tawa,         % to move, to displace
     telo,         % to water, to wash with water, to put water to, to melt, to liquify
     tomo,         % to build, to construct, to engineer
     toki,         % to speak, to talk, to say, to pronounce, to discourse
     tu,           % to divide, to double, to separate, to cut in two
     unpa,         % to have sex with, to sleep with, to fuck
     uta,          % to kiss, to osculate, to oral stimulate, to suck
     utala,        % to hit, to strike, to attack, to compete against
     walo,         % to whiten, to whitewash
     wan,          % to unite, to make one
     wawa,         % to strengthen, to energize, to empower
     weka,         % to remove, to eliminate, to throw away, to remove, to get rid of
     wile          % to want, need, wish, have to, must, will, should
 ])
}.

verb_pre(verb_pre(Verb_pre),Verb_pre) --> [Verb_pre], { member(Verb_pre, [
     kama,         % to become, to mange to
     ken,          % to can, may
     kepeken,      % to use
     lukin,        % to seek to, try to, look for
%     open,         % to begin, to start
%     pini,         % to stop, to finish, to end, to interrupt 
     pu,           % buying and interacting with the official Toki Pona book
     sona,         % to know how to
     wile          % to want, need, wish, have to, must, will, should
 ])
}.

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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial Words
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

continent(continent(ADJ),X)           --> continent_catalog(ADJ,X), !.                                                                  % The "!" stop the search after find something in *_catalog.
:- ['unofficial_words_continent_catalog-parse-tree.pro'].                                                                               % Load the file with the *_catalog of unofficial words
continent(continent(ADJ),X)           --> word_unofficial(ADJ,X).                                                                       % If the word not in the catalog check it spelling only.

country(country(ADJ),X)               --> country_catalog(ADJ,X), !. 
:- ['unofficial_words_country_catalog-parse-tree.pro'].
country(country(ADJ),X)               --> word_unofficial(ADJ,X). 

city(city(ADJ),X)                     --> city_catalog(ADJ,X), !.
:- ['unofficial_words_city_catalog-parse-tree.pro'].
city(city(ADJ),X)                     --> word_unofficial(ADJ,X).

language(language(ADJ),X)             --> language_catalog(ADJ,X), !.
:- ['unofficial_words_language_catalog-parse-tree.pro'].
language(language(ADJ),X)             --> word_unofficial(ADJ,X) .

sign_language(sign_language(ADJ,X))   --> language(ADJ,X).                                                                             % sign_language = language

ideology(ideology(ADJ),X)             --> ideology_catalog(ADJ,X), !.
:- ['unofficial_words_ideology_catalog-parse-tree.pro'].
ideology(ideology(ADJ),X)             --> word_unofficial(ADJ,X) .

community(community(ADJ),X)           --> community_catalog(ADJ,X), !.  
:- ['unofficial_words_community_catalog-parse-tree.pro'].
community(community(ADJ),X)           --> word_unofficial(ADJ,X).

resident(resident(ADJ),X)            --> country(ADJ,X).                                                                               % resident = country

female_prominent_personage(female_prominent_personage(ADJ),X)  --> female_prominent_personage_catalog(ADJ,X), !.
:- ['unofficial_words_female_prominent_personage_catalog-parse-tree.pro'].

male_prominent_personage(male_prominent_personage(ADJ),X)    --> male_prominent_personage_catalog(ADJ,X), !.
:- ['unofficial_words_male_prominent_personage_catalog-parse-tree.pro'].

female_name(female_name(ADJ),X)      --> female_name_catalog(ADJ,X), !.
:- ['unofficial_words_female_name_catalog-parse-tree.pro'].
female_name(female_name(ADJ),X)      --> word_unofficial(ADJ,X) .

male_name(male_name(ADJ),X)          --> male_name_catalog(ADJ,X), !.
:- ['unofficial_words_male_name_catalog-parse-tree.pro'].
male_name(male_name(ADJ),X)          --> word_unofficial(ADJ,X) .

movies(movies(ADJ),X)                --> movies_catalog(ADJ,X), !.
:- ['unofficial_words_movies_catalog-parse-tree.pro'].
movies(movies(ADJ),X)                --> word_unofficial(ADJ,X) .

unofficial_words_miscellaneous(unofficial_words_miscellaneous(ADJ),X) --> unofficial_words_miscellaneous_catalog(ADJ,X), !.
:- ['unofficial_words_miscellaneous_catalog-parse-tree.pro'].
unofficial_words_miscellaneous(unofficial_words_miscellaneous(ADJ),X) --> word_unofficial(ADJ,X).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial Words - check spelling

%word_unofficial(Word,[Word|T],T) :-                                                               % old version without parse tree. 
   
word_unofficial(word_unofficial([]),Word,[Word|T],T) :-                                            % This pure prolog rule make it possible to use DCG for spell check.    
     atom_length(Word,L),                                                                          % Get the lenght of the unofficial word.
     (L > 1, L =< 15),                                                                             % An unofficial word can have 2 to 15 characters. 
     atom_chars(Word,CL),                                                                          % atom_chars() convert an Atom (Word) in a list of character codes (CL). 
     word_unofficial_list(CL,[]), !.                                                               % The cut operator (!) mean: Don't try more than one true solution. 

word_unofficial_list    --> syllable_first, syllables.

syllables               --> [].                                                                    % No syllable.
syllables               --> syllable, syllables.                                                   % One or more syllabes.

syllable                --> consonant_small(Cs),                                                   % Each syllable consists of a consonant plus a vowel, plus an optional "n".
                            vowel_small(Vs),    
                            { not(invalid_letter_combination(Cs,Vs)) },                            % pure prolog rule to check valid letter combinations.
                            optional_n.
                                 
syllable_first          --> consonant_capital(Cs),                                                 % The first syllable of a word does not need to beginn with a consonant.
                            vowel_small(Vs),    
                            { not(invalid_letter_combination(Cs,Vs)) }, 
                            optional_n.
syllable_first          --> vowel_capital(_),  consonant_small(_).                                 % The first syllable of a word does not need to beginn with a consonant.
syllable_first          --> vowel_capital(_),  consonant_small(_),  vowel_small(_), optional_n.

optional_n              --> [].
optional_n              --> consonant_small('n').

invalid_letter_combination('T','i').                                                               % The syllables "ti" and "tin" become "si" and "sin".
invalid_letter_combination('t','i').
invalid_letter_combination('W','o').                                                               % The consonant "w" cannot appear before "o" or "u".
invalid_letter_combination('w','o').
invalid_letter_combination('W','u').
invalid_letter_combination('w','u').
invalid_letter_combination('J','i').                                                               % The consonant "j" cannot appear before "i".
invalid_letter_combination('j','i').


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Letters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Possible letters for unofficial words. The most frequently used letter is on the first position. 

consonant_capital(Consonant_capital) --> [Consonant_capital], { member(Consonant_capital, [ 'P', 'S', 'K', 'L', 'M', 'T', 'N', 'W', 'J' ])}.
consonant_small(Consonant_small)     --> [Consonant_small],   { member(Consonant_small,   [ 'p', 's', 'k', 'l', 'm', 't', 'n', 'w', 'j' ])}.
vowel_capital(Vowel_capital)         --> [Vowel_capital],     { member(Vowel_capital,     [ 'A', 'E', 'I', 'U', 'O' ])}.
vowel_small(Vowel_small)             --> [Vowel_small],       { member(Vowel_small,       [ 'a', 'e', 'i', 'u', 'o' ])}.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For a user friendly input:
:- ['check_grammar_parse_tree.pro']. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

% Sentences with right grammar:

?- check_grammar(Parse_tree).
|: mi moku.
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(pronoun_no_li(pronoun(mi))), verb_phrase(verb_transitive_compound([], [], verb_transitive(moku), []), [], []))), separator('.')) ;
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(pronoun_no_li(pronoun(mi))), verb_phrase(verb_be(''), adjectives_at_least_one(adjectiv(moku)), adjectives([], [], [], [], [])))), separator('.')) ;
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(pronoun_no_li(pronoun(mi))), verb_phrase(verb_be(''), noun_compound(noun(moku), adjectives([], [], [], [], []), [])))), separator('.')) ;

?- check_grammar(Parse_tree).
|: tenpo pi suli mute li pona.
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(noun_compound(noun(tenpo), adjectives([], [], [], [], []), noun_pi_groups(noun_pi_group(separator(pi), noun(suli), adjectives_at_least_one(adjectiv(mute)), adjectives([], [], [], [], []), []))), [], separator(li)), verb_phrase(verb_transitive_compound([], [], verb_transitive(pona), []), [], []))), separator('.')) ;
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(noun_compound(noun(tenpo), adjectives([], [], [], [], []), noun_pi_groups(noun_pi_group(separator(pi), noun(suli), adjectives_at_least_one(adjectiv(mute)), adjectives([], [], [], [], []), []))), [], separator(li)), verb_phrase(verb_be(''), adjectives_at_least_one(adjectiv(pona)), adjectives([], [], [], [], [])))), separator('.')) ;
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(noun_compound(noun(tenpo), adjectives([], [], [], [], []), noun_pi_groups(noun_pi_group(separator(pi), noun(suli), adjectives_at_least_one(adjectiv(mute)), adjectives([], [], [], [], []), []))), [], separator(li)), verb_phrase(verb_be(''), noun_compound(noun(pona), adjectives([], [], [], [], []), [])))), separator('.')) ;
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(noun_compound(noun(tenpo), adjectives([], [], [], [], []), noun_pi_groups(noun_pi_group(separator(pi), noun(suli), adjectives_at_least_one(numeral(mute)), adjectives([], [], [], [], []), []))), [], separator(li)), verb_phrase(verb_transitive_compound([], [], verb_transitive(pona), []), [], []))), separator('.')) ;
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(noun_compound(noun(tenpo), adjectives([], [], [], [], []), noun_pi_groups(noun_pi_group(separator(pi), noun(suli), adjectives_at_least_one(numeral(mute)), adjectives([], [], [], [], []), []))), [], separator(li)), verb_phrase(verb_be(''), adjectives_at_least_one(adjectiv(pona)), adjectives([], [], [], [], [])))), separator('.')) ;
Parse_tree = (sentence_declarative([], [], sentence_simple(noun_phrase(noun_compound(noun(tenpo), adjectives([], [], [], [], []), noun_pi_groups(noun_pi_group(separator(pi), noun(suli), adjectives_at_least_one(numeral(mute)), adjectives([], [], [], [], []), []))), [], separator(li)), verb_phrase(verb_be(''), noun_compound(noun(pona), adjectives([], [], [], [], []), [])))), separator('.')) ;

 
As you can see, the code is not optimal. But it works :-)


% Sentences with wrong grammar:

?- check_grammar(Parse_tree).
|: mi ken ala weka pi tan lawa e kama ni pi lon lon pi selo insa oko mi pi pali mute.
false.


To Do:
pretty printing

https://user.phil-fak.uni-duesseldorf.de/~rumpf/WS2004/Prolog/h8.pdf

http://www.learnprolognow.org/lpnpage.php?pagetype=html&pageid=lpn-htmlse42

https://github.com/dragonwasrobot/learn-prolog-now-exercises/blob/master/chapter-12/practical-session.pl

http://www.swi-prolog.org/pldoc/doc/swi/library/pprint.pl




*/

Include File for Check Grammar

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,[]). 

Here is the code of the include file check_grammar_parse_tree.pro.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Learn Definite Clause Grammars 
% Read a line of words from the user and check the grammar.
% Every word and !,.:;? are elements of a list.
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For a user friendly input:

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.  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof 

Include Files for Unofficial Words

We have to handle two arguments for the terminal symbols in every include file also.

unofficial_words_continent_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Continents
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

continent_catalog(continent_catalog(Continent_catalog),Continent_catalog) --> [Continent_catalog], { member(Continent_catalog, [
     'Amelika',       % Americas, North America: 'Amelika lete', South America: 'Amelika seli'
     'Antasika',      % Antarctica
     'Apika',         % Africa
     'Asija',         % Asia
     'Elopa',         % Europe
     'Osejanija'      % Oceania
 ])
}.

/*
?- continent_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_country_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Countries
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

country_catalog(country_catalog(Country_catalog),Country_catalog) --> [Country_catalog], { member(Country_catalog, [  
     'Akanisan',    % Afghanistan
     'Alan',        % Ireland
     'Alensina',    % Argentina
     'Anku',        % Korea
     'Antola',      % Andorra
     'Awisi',       % Haiti
     'Ekato',       % Ecuador
     'Elena',       % Greece
     'Epanja',      % Spain
     'Esi',         % Estonia
     'Esuka',       % Basque Country
     'Ilakija',     % Iraq
     'Ilan',        % Iran
     'Inli',        % England
     'Intonesija',  % Indonesia
     'Isale',       % Israel
     'Isilan',      % Iceland
     'Italija',     % Italy
     'Jamanija',    % Yemen
     'Kalalinuna',  % Greenland
     'Kana',        % Ghana
     'Kanata',      % Canada
     'Kanse',       % France
     'Katala',      % Qatar
     'Katelo',      % Georgia
     'Katemala',    % Guatemala
     'Kenata',      % Grenada
     'Kepeka',      % Quebec
     'Keposi',      % Cyprus
     'Kilipasi',    % Kiribati
     'Kinla',       % Wales
     'Konko',       % Congo, Dem. Rep.  (pi ma tomo Kinsasa), Congo, P. Rep. (pi ma tomo Pasawi)
     'Kosalika',    % Costa Rica
     'Kosiwa',      % Côte d'Ivoire
     'Kupa',        % Cuba
     'Kusala',      % Gujarat
     'Kuwasi',      % Kuweit
     'Lanka',       % Sri Lanka
     'Lesi',        % Brittany
     'Lipija',      % Libya
     'Lisensan',    % Liechtenstein
     'Lomani',      % Romania
     'Losi',        % Russia
     'Lowasi',      % Croatia
     'Lowenki',     % Slovakia
     'Lowensina',   % Slovenia
     'Lunpan',      % Lebanon
     'Lusepu',      % Luxemburg
     'Luwanta',     % Rwanda
     'Maketonija',  % Macedonia
     'Malakasi',    % Madagascar
     'Malasija',    % Malaysia
     'Malawi',      % Malawi
     'Mali',        % Mali
     'Malipe',      % Morocco
     'Masija',      % Hungary
     'Masu',        % Egypt
     'Mesiko',      % Mexico
     'Mewika',      % USA, American
     'Mijama',      % Myanmar
     'Motowa',      % Moldova
     'Mulitanija',  % Mauritania
     'Namipija',    % Namibia
     'Naselija',    % Nigeria
     'Netelan',     % Netherlands
     'Nijon',       % Japan
     'Nise',        % Niger
     'Nosiki',      % Norway
     'Nusilan',     % New Zealand
     'Ontula',      % Honduras
     'Osalasi',     % Austria
     'Oselija',     % Australia
     'Pakisan',     % Pakistan
     'Palakawi',    % Paraguay
     'Palani',      % Bahrein
     'Palata',      % India
     'Panama',      % Panama
     'Panla',       % Bangladesh
     'Papeto',      % Barbados
     'Papuwanijukini',  % Papua New Guinea
     'Pasila',      % Brasil
     'Pawama',      % Bahamas
     'Pelalusi',    % Belarus
     'Pelu',        % Peru
     'Pemuta',      % Bermuda
     'Penesuwela',  % Venezuela
     'Penin',       % Benin
     'Pesije',      % Belgium
     'Pilipina',    % Philipines
     'Pilisin',     % Palestine
     'Pisi',        % Fiji
     'Piten',       % Britain, UK
     'Pokasi',      % Bulgaria
     'Posan',       % Bosnia and Herzegovina
     'Posuka',      % Poland
     'Potuke',      % Portugal
     'Samalino',    % San Marino
     'Sameka',      % Jamaica
     'Samowa',      % Samoa
     'Sasali',      % Algeria
     'Sawa',        % Java
     'Sawasi',      % Swaziland
     'Seki',        % Czech (Republic)
     'Seneka',      % Senegal
     'Setapika',    % South Africa
     'Sile',        % Chile
     'Sinita',      % Trinidad and Tobago
     'Sipusi',      % Djibouti
     'Sonko',       % China, Chinese
     'Sopisi',      % Serbia
     'Sukosi',      % Scotland
     'Sulija',      % Syria
     'Sumi',        % Finland
     'Sutan',       % Sudan
     'Suwasi',      % Switzerland
     'Tansi',       % Denmark
     'Tawi',        % Thailand
     'Toko',        % Togo
     'Tominika',    % Dominican Republic
     'Tona',        % Tonga
     'Tosi',        % Germany
     'Tuki',        % Turkey
     'Tunisi',      % Tunisia
     'Tuwalu',      % Tuvalu
     'Ukanta',      % Uganda
     'Ukawina',     % Ukraine
     'Ulukawi',     % Uruguay
     'Uman',        % Oman
     'Utun',        % Jordan
     'Wanuwatu',    % Vanuatu
     'Wasikano',    % Vatican
     'Wensa',       % Sweden
     'Wije'         % Vietnam
 ])
}.

/*
?- country_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_city_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Cities
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

city_catalog(city_catalog(City_catalog),City_catalog) --> [City_catalog], { member(City_catalog, [  
     'Akajela',      % Al-Qahirah, Kairo (Capital of Egypt) 
     'Alana',        % Atlanta (USA) 
     'Alawa',        % Ottawa (Capital of Canada) 
     'Alenta',       % Atlanta (USA) 
     'Alipasi',      % Halifax (Canada) 
     'Anpu',         % Hamburg (Germany) 
     'Ansetan',      % Amsterdam (Capital of Netherlands) 
     'Asina',        % Athen (Capital of Greece) 
     'Ele',          % Los Angeles (USA) 
     'Esupo',        % Espoo (Finland) 
     'Iwesun',       % Hilversum (Netherlands)  
     'Kakawi',       % Calgary (Canada) 
     'Kenpisi',      % Cambridge (USA, UK) 
     'Kunte',        % Krung Thep; Bangkok (Capital of Thailand) 
     'Lantan',       % London (Caiptal of UK)
     'Lesinki',      % Helsinki; Helsingfors (Capital of Finnland) 
     'Loma',         % Rome (Capital of Italy) 
     'Manten',       % Moncton (Canada) 
     'Mesiko',       % Mexiko-Stadt (Capital of Mexiko) 
     'Milano',       % Milan (Italy) 
     'Minsen',       % Munich (Germany) 
     'Monkela',      % Montreal (Canada) 
     'Napoli',       % Napoli, Neapel (Italy) 
     'Nujoka',       % New York City (USA) 
     'Osaka',        % Osaka (Japan)  
     'Paki',         % Paris (Capital of France) 
     'Pasen',        % Boston (USA) 
     'Pelin',        % Berlin (Capital of Germany) 
     'Peminan',      % Birmingham (England)  
     'Pesin',        % Beijing; Peking (Capital of China) 
     'Pilense',      % Florenz (Italy) 
     'Polan',        % Portland (USA) 
     'Putapesi',     % Budapest (Capital of Hungary) 
     'Sakata',       % Jakarta (Capital of Indonesia) 
     'Sanpansiko',   % San Francisco (USA) 
     'Sawi',         % Sackville (Canada) 
     'Sene',         % Genf (Switzerland) 
     'Sensan',       % St. John's (Canada) 
     'Sesija',       % Shediac (Canada) 
     'Sije',         % Dieppe (Canada) 
     'Solu',         % Seoul (Capital of South Korea) 
     'Tanpele',      % Tampere (Finland) 
     'Telawi',       % Tel Aviv (Israel) 
     'Tokijo',       % Tokyo; Tokio (Capital of Japan)  
     'Towano',       % Toronto (Canada) 
     'Tuku',         % Turku (Finland) 
     'Wankuwa',      % Vancouver (Canada) 
     'Wenesija'      % Venedig (Italy) 
 ])
}.

/*
city_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof


unofficial_words_community_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Communities
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

community_catalog(community_catalog(Community_catalog),Community_catalog) --> [Community_catalog], { member(Community_catalog, [  
     'Neje'       % Nerds     
 ])
}.

/*
?- community_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_language_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Language
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

language_catalog(language_catalog(Language_catalog),Language_catalog) --> [Language_catalog], { member(Language_catalog, [  
     'Alan',        % Irish Gaelic
     'Alapi',       % Arab; Arabic; Arabian 
     'Anku',        % Korean
     'Apikan',      % Afrikaans 
     'Awasa',       % Hausa 
     'Awisi',       % Haitian Creole
     'Elena',       % Greek
     'Epanja',      % Spanish
     'Epelanto',    % Esperanto (constructed language)
     'Esi',         % Estonian
     'Esuka',       % Basque
     'Ewantalu',    % Ewantal 
     'Ilan',        % Persian
     'Inli',        % English
     'Inli pona',   % Basic English (constructed language)
     'Insi',        % Hindi 
     'Intelinka',   % Interlingua (constructed language)
     'Intonesija',  % Indonesian
     'Inu',         % Inupiaq, Inuktitut, Eskimo 
     'Ipo',         % Igbo
     'Isilan',      % Icelandic
     'Italija',     % Italian
     'Ito',         % Ido (constructed language)
     'Iwisi',       % Hebrew
     'Jolupa',      % Yoruba 
     'Kalalinuna',  % Greenlandic
     'Kalike',      % Schottisches Gaelik 
     'Kanse',       % French
     'Kantun',      % Kantonesisch 
     'Katelo',      % Georgian
     'Kinla',       % Welsh
     'Kisawili',    % Suaheli, Swahili 
     'Kusala',      % Gujarati
     'Kuwenja',     % Quenya, Elvish 
     'Lesi',        % Breton
     'Lolan',       % Loglan (constructed language)     
     'Loma',        % Latin 
     'Lomani',      % Romanian
     'Losi',        % Russian
     'Losupan',     % Lojban (constructed language)
     'Lowasi',      % Croatian
     'Lowenki',     % Slovak
     'Lowensina',   % Slovenian
     'Lunasimi',    % Quechua 
     'Lusepu',      % Luxemburg
     'Maketonija',  % Macedonia
     'Malakasi',    % Malagasy
     'Malasija',    % Malay
     'Malasi',      % Marathi 
     'Masija',      % Hungarian
     'Netelan',     % Dutch
     'Nijon',       % Japanese
     'Nosiki',      % Norwegian Bokmål
     'Nosiki sin',  % Norwegian Nynorsk 
     'Olapu',       % Volapuek (constructed language) 
     'Panla',       % Bengali
     'Pansapi',     % Punjabi 
     'Pasiki',      % Fyksian 
     'Pasuto',      % Pashto 
     'Pelalusi',    % Belarussian
     'Pilipina',    % Tagalog
     'Pokasi',      % Bulgarian
     'Posan',       % Bosnian
     'Posuka',      % Polish
     'Potuke',      % Portugese
     'Sameka',      % Jamaican Patoi
     'Sami',        % Laplander 
     'Sankitu',     % Sanskrit 
     'Sawa',        % Javanese
     'Sawasi',      % Swaziland
     'Seki',        % Czech
     'Sinan',       % Klingonisch (constructed language) 
     'Sonko',       % Chinese
     'Sopisi',      % Serbian
     'Sukosi',      % Scots
     'Sumi',        % Finnish
     'Tamasiko',    % Berber, Tamazight 
     'Tami',        % Tamil 
     'Tansi',       % Danish
     'Tawi',        % Thai
     'Teluku',      % Telugu 
     'Tona',        % Tongan
     'Tosi',        % German
     'Tuki',        % Turkish
     'Ukawina',     % Ukrainian
     'Utu',         % Urdu 
     'Wensa'        % Swedish
 ])
}.

/*
?- language_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_ideology_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Ideologies, Religions
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ideology_catalog(ideology_catalog(Ideology_catalog),Ideology_catalog) --> [Ideology_catalog], { member(Ideology_catalog, [  
     'Jawatu',      % Judaism
     'Juju',        % Universalism  
     'Kolisu',      % Christianity     
     'Latapali',    % Rastafarianism 
     'Patapali',    % Pastafarianism
     'Puta',        % Buddhism 
     'Silami'       % Islam 
 ])
}.

/*
?- ideology_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_female_prominent_personage_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Female Prominent Personage
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
% http://tokipona.net/tp/Transliterate.aspx
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

female_prominent_personage_catalog(female_prominent_personage_catalog(Female_prominent_personage_catalog),Female_prominent_personage_catalog) --> [Female_prominent_personage_catalog], { member(Female_prominent_personage_catalog, [  
     'Anela Melike',       % Angela Merkel
     'Mawija',             % Maria Magdalena
     'Mawija  Makalena'    % Maria Magdalena
 ])
}.

/*
?- female_prominent_personage_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_male_prominent_personage_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Male Prominent Personage
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
% http://tokipona.net/tp/Transliterate.aspx
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

male_prominent_personage_catalog(male_prominent_personage_catalog(Male_prominent_personage_catalog),Male_prominent_personage_catalog) --> [Male_prominent_personage_catalog], { member(Male_prominent_personage_catalog, [ 
     'Alipe Eintein',      % Albert Einstein
     'Kae Mae',            % Karl Marx
     'Mose',               % Moses 
     'Santa',              % Santa Claus 
     'Wasintan'            % Washington
 ])
}.

/*
?- male_prominent_personage_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_female_name_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Female Names
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
% http://tokipona.net/tp/Transliterate.aspx
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

female_name_catalog(female_name_catalog(Female_name_catalog),Female_name_catalog) --> [Female_name_catalog], { member(Female_name_catalog, [  
     'Ana',         % Ana, Anna
     'Epi',         % Abbie
     'Eta',         % Heather 
     'Keli',        % Kelly, Keli 
     'Lisa',        % Lisa
     'Mewi',        % Mary
     'Sesi',        % Jessie
     'Susan',       % Susan
     'Tepani'       % Stefanie, Steffany
 ])
}.

/*
?- female_name_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

unofficial_words_male_name_catalog-parse-tree.pro
Source code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unofficial words - Male Names
% Include File
% by Robert Warnke http://rowa.giso.de
% released under the GNU General Public License 
%
% http://tokipona.net/tp/Transliterate.aspx
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

male_name_catalog(male_name_catalog(Male_name__catalog),Male_name__catalog) --> [Male_name__catalog], { member(Male_name__catalog, [  
     'Ken',         % Ken
     'Lopa',        % Robert
     'Lope',        % Robert 
     'Mawen',       % Marwin
     'Nesan',       % Nathan
     'Nikita';      % Nikita
     'Pawe',        % Paul
     'Pentan',      % Brandon
     'Pepe',        % Pepe
     'Ta',          % Todd
     'San'          % John
 ])
}.

/*
?- male_name_catalog(X,_,_).
*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof

 


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