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
 
Lession 19
 
Contact
 
 

 
Home | Text version
 
Download swi-prolog | Download these scripts

Learn Definite Clause Grammars (DCG) with Toki Pona

Lession 15

Now the DCG rules for the Toki Pona lesson la.

The Main Programm

Some people use "la" with a comma before. In my opinion this is not necessary because "la" is the separator.

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

For sentences with "la" we need a new phrase.

la_phrases               --> [].                                                                                                       % no "la" phrase
la_phrases               --> la_phrase. 
la_phrases               --> la_phrase, la_phrase.
la_phrase                --> noun_compound,                          comma_optional,    separator(la),      comma_optional.            % ...     la (,)
la_phrase                --> noun_phrase,          verb_phrase,      comma_optional,    separator(la),      comma_optional.            % ... (,) la (,)
la_phrase_follow         --> comma_optional,    separator(la),       comma_optional,    noun_compound.                                 % la phrase at the end of a sentences.
la_phrases_question      --> question,                               comma_optional,    separator(la),      comma_optional.            % A question as a "la" phrase.

We add rules with this new phrase.

sentence_declarative     --> la_phrase,                                                 sentence_simple.         
sentence_declarative     --> sentence_simple,                                la_phrase_follow.                             % A declarative sentence can build of a simple sentence and optional "la"-phrases.
         
sentence_declarative     --> la_phrase,  sentence_simple,  separator(':'),  la_phrase,  sentence_simple.                   

sentence_imperative      --> la_phrase,                                                 imperative,      interjection_optional. 
sentence_imperative      -->              imperative,   la_phrase_follow,                                interjection_optional. % An imperative sentence (command). Optional: ... la ...o, ... .
sentence_imperative      --> la_phrase,  sentence_simple,  separator(':'),  la_phrase,  imperative,      interjection_optional.
sentence_imperative      --> la_phrase,  imperative,       separator(':'),  la_phrase,  sentence_simple, interjection_optional. 
sentence_imperative      --> la_phrase,  imperative,       separator(':'),  la_phrase,  imperative,      interjection_optional.

sentence_interrogative   --> la_phrase,                                                 question,        interjection_optional. 
sentence_interrogative   --> la_phrase,  sentence_simple,  separator(':'),  la_phrase,  question,        interjection_optional.
sentence_interrogative   --> la_phrase,  question,         separator(':'),  la_phrase,  sentence_simple, interjection_optional. 
sentence_interrogative   --> la_phrase,  question,         separator(':'),  la_phrase,  question,        interjection_optional.

With "la" we can build question "How many":

question                 --> question_how_many.	
question_how_many        --> subject,   separator(pi),  noun(mute),  question_word(seme),   separator(la) ,       noun_phrase,    verb_phrases.                            
question_how_many        --> subject,   separator(pi),  noun(mute),  question_word(seme),   separator(li),                        verb_phrases.

With "la" there is possible to build an other form of why-questions.

question_why             --> noun(tan),   question_word(seme),   separator(la), noun_phrase,  verb_phrases.     

We add rules for when-questions.

question                 --> question_when.
question_when            --> noun_phrase,          verb_phrases,          preposition(lon),   noun(tenpo),                     question_word(seme). 
question_when            --> noun(tenpo),          question_word(seme),   separator(la),      noun_phrase,                     verb_phrases. 

The rules for this Toki pona lesson are complete now. But we have to add some rules for the text examples in the apendix. In this example "kin" is used to emphasize the pre-verb "ken": taso sina kin ken kama sona e ijo sin.

verb_transitive_compound   --> verb_pre(kin), verb_pre(Verb_pre), {Verb_pre\=kin}, adverbs, verb_transitive(Verb),   {Verb\=Verb_pre}, adverbs.   
verb_intransitive_compound --> verb_pre(kin), verb_pre(Verb_pre), {Verb_pre\=kin}, adverbs, verb_intransitive(Verb), {Verb\=Verb_pre}, adverbs.

Here a more general form for unofficial words.

designate               --> noun(nimi), separator(pi), noun(_),       adjectives_pure, pronoun(_), separator(li), unofficial_words_miscellaneous(_).
	
adjectives              --> adjectives_pure,     unofficial_words_miscellaneous.
	
unofficial_words_miscellaneous(X)
:- ['unofficial_words_miscellaneous_catalog.pro'].
unofficial_words_miscellaneous(X)       --> word_unofficial(X) .

Headings can be incomplete sentences and do not end with a punctuation mark.

sentence                 --> headline.	
headline                 --> subject.

Here are the source code of toki-pona-15.pro.


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

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

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

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

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

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

sentence_imperative      --> conjunctions, la_phrases,                                                  imperative,      interjection_optional. % An imperative sentence (command). Optional: ... la ...o, ... .
sentence_imperative      --> conjunctions,              imperative,   la_phrase_follow,                                  interjection_optional. % An imperative sentence (command). Optional: ... la ...o, ... .
sentence_imperative      --> conjunctions, la_phrases,  sentence_simple,  separator(':'),  la_phrases,  imperative,      interjection_optional.
sentence_imperative      --> conjunctions, la_phrases,  imperative,       separator(':'),  la_phrases,  sentence_simple, interjection_optional. 
sentence_imperative      --> conjunctions, la_phrases,  imperative,       separator(':'),  la_phrases,  imperative,      interjection_optional.
sentence_imperative      --> conjunctions, vocativ_imperative,                                                           interjection_optional. % An imperative sentence (command) can be a vocativ imperativ.

sentence_interrogative   --> conjunctions, la_phrases,                                                  question,        interjection_optional. % An interrogative sentence (question) can be a question. Optional with "la" phrase.
sentence_interrogative   --> conjunctions, la_phrases,  sentence_simple,  separator(':'),  la_phrases,  question,        interjection_optional.
sentence_interrogative   --> conjunctions, la_phrases,  question,         separator(':'),  la_phrases,  sentence_simple, interjection_optional. 
sentence_interrogative   --> conjunctions, la_phrases,  question,         separator(':'),  la_phrases,  question,        interjection_optional.
sentence_interrogative   --> conjunctions, la_phrases_question,                                         sentence_simple, interjection_optional. % A question as "la" phrase.
sentence_interrogative   --> conjunctions, vocativ_question,                                                             interjection_optional. % An interrogative sentence (question) can be a vocativ question.


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

sentence_simple          --> noun_phrase,          verb_phrases.                                                          % A simple sentence consist of a noun phrase and verb phrases. 

answer_yes               -->                       verb_transitive(_).
answer_yes               --> verb_pre(Vp),         verb_transitive(V), {V\=Vp}.
answer_yes               --> verb_pre(_).

answer_no                -->                                                 noun(ala).
answer_no                -->                       verb_transitive(_),       adverb(ala).
answer_no                --> verb_pre(Vp),                                   adverb(ala),  verb_transitive(V), {V\=Vp}.
answer_no                --> verb_pre(_),                                    adverb(ala).

vocativ                  --> subject,                                        separator(o).
vocativ                  --> subject,                                        separator(o), separator(','), noun_phrase, verb_phrases.
vocativ_interjection     --> subject,                                        separator(o), separator(','),              verb_phrases.

interjection             --> interjection_word(_).
interjection             --> interjection_word(a), interjection_word(a),     interjection_word(a).                                       % "a a a." laughing
interjection             --> subject,                                        separator(o),                   interjection_word(a).       % Addressing people really emotional.
interjection             --> la_phrases,  sentence_simple,                                                   interjection_word(a).       % A interjection sentence can build of an optional "la"-phrase, a simple sentence and an "a"..
interjection             --> la_phrases,  sentence_simple,   separator(':'),  la_phrases,  sentence_simple,  interjection_word(a).       % A interjection sentence can build of two simple sentences with optional "la" phrases separated by a colon and followed by an "a".
interjection             --> la_phrases,  noun_phrase_interjection,           verb_phrases.                                              % A interjection sentence consist of an optional "la"-phrase interjection, a noun phrase and verb phrases. 
interjection             --> noun_compound,                                                                  interjection_word(a).

salutation               --> noun(suno),                    adjectiv(pona).                                                              % Salutation: "Good day!"
salutation               --> noun(lape),                    adjectiv(pona).                                                              % Salutation: "Sleep well!"
salutation               --> noun(moku),                    adjectiv(pona).                                                              % Salutation: "Enjoy your meal!"
salutation               --> noun(tawa),                    adjectiv(pona).                                                              % Salutation: "Good bye!"
salutation               --> noun(kama),                    adjectiv(pona).                                                              % Salutation: "Welcome!"
salutation               --> noun(musi),                    adjectiv(pona).                                                              % Salutation: "Have fun!"
salutation               --> pronoun(mi),                   adjectiv(tawa).                                                              % Salutation: "Good bye!" (I go)   
salutation               --> pronoun(mi), adjectiv(mute),   adjectiv(tawa).                                                              % Salutation: "Good bye!" (we go) 
salutation               --> noun(pona),                    adjectiv(mute).                                                              % Salutation: "Very good!"
salutation               --> noun(pona),                    adjectiv(mute), adjectiv(mute).                                              % Salutation: "Very, very good!"
salutation               --> noun(pona),                    adjectiv(mute), adjectiv(mute), adjectiv(mute).                              % Salutation: "Excellent!"

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

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

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

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

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

question_pardon          --> question_word(seme).

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

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

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

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

question_where           --> noun_phrase,                                 preposition(lon),                                                                           question_word(seme).

question_wherefrom       --> noun_phrase,  verb_transitive(kama),         preposition(tan),                               noun_compound,                              question_word(seme).

question_who             --> noun(jan),            question_word(seme),   noun_pi_groups,     separator(li),   verb_phrases.
question_who             --> noun(meli),           question_word(seme),   noun_pi_groups,     separator(li),   verb_phrases.
question_who             --> noun(mije),           question_word(seme),   noun_pi_groups,     separator(li),   verb_phrases.

question_whom            --> noun_phrase,          verb_phrases,          separator(e),       noun(jan),       adjectives,     question_word(seme).
question_whom            --> noun_phrase,          verb_phrases,          separator(e),       noun(meli),      adjectives,     question_word(seme).
question_whom            --> noun_phrase,          verb_phrases,          separator(e),       noun(mije),      adjectives,     question_word(seme).
question_whom            --> noun_phrase,          verb_phrases,          preposition(_),     noun(jan),       adjectives,     question_word(seme).
question_whom            --> noun_phrase,          verb_phrases,          preposition(_),     noun(meli),      adjectives,     question_word(seme).
question_whom            --> noun_phrase,          verb_phrases,          preposition(_),     noun(mije),      adjectives,     question_word(seme).

question_which_subject   --> subject, question_word(seme),                separator(li),                      verb_phrases.

question_which_object_d  --> noun_phrase,                                 verb_transitive_compound,                                 separator(e),                     noun(N), {N\=jan,N\=meli,N\=mije,N\=tan,N\=tenpo}, adjectives, question_word(seme).
question_which_object_i  --> noun_phrase,                                 verb_intransitive_compound,                                                                 noun(N), {N\=jan,N\=meli,N\=mije,N\=tan,N\=tenpo}, adjectives, question_word(seme).
question_which_object_p  --> noun_phrase,                                 verb_transitive_compound,                                 preposition(P), {P\=lon,P\=tan},  noun(N), {N\=jan,N\=meli,N\=mije,N\=tan,N\=tenpo}, adjectives, question_word(seme).

question_when            --> noun_phrase,          verb_phrases,          preposition(lon),   noun(tenpo),                     question_word(seme).                                        % mama sina li kama lon tenpo seme?
question_when            --> noun(tenpo),          question_word(seme),   separator(la),      noun_phrase,                     verb_phrases.                                               % tenpo seme la mama sina li kama?

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

question_how             --> noun_phrase, verb_phrases, preposition(kepeken), noun(nasin),  question_word(seme).

question_or_what         --> noun_phrase, verb_phrases,             conjunction(anu),       question_word(seme).

question_decision_s      --> subject,                               conjunction(anu),       subject,              separator(li),  verb_phrases.
question_decision_v      --> noun_phrase, verb_phrases,             conjunction(anu),                                             verb_phrases.

question_how_many        --> subject,      separator(pi),  noun(mute),  question_word(seme),   separator(la) ,       noun_phrase,    verb_phrases.                                         % tenpo pi mute seme la sina sike e suno?  (How old are you?)
question_how_many        --> subject,      separator(pi),  noun(mute),  question_word(seme),   separator(li),                        verb_phrases.                                         % tomo pi mute seme li lon?
question_how_many        --> noun_phrase,  verb_phrases,   separator(e),  noun_compound,   separator(pi),  noun(mute),   question_word(seme).                                              % jan Konan li moku e kili pi mute seme?

headline                 --> subject.
headline                 --> intrans_objects,  prepositional_objects.


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

noun_phrase              --> pronoun_no_li.
noun_phrase              --> pronoun_no_li,             conjunction(en), subject, subject_add,   separator(li).
noun_phrase              --> pronoun_with_li,           subject_add,                             separator(li).
noun_phrase              --> noun_compound,             subject_add,                             separator(li).

noun_phrase_interjection --> pronoun_no_li,                                                      interjection_word(a).
noun_phrase_interjection --> pronoun_no_li,             conjunction(en), subject, subject_add,   interjection_word(a),  separator(li).
noun_phrase_interjection --> pronoun_with_li,           subject_add,                             interjection_word(a),  separator(li).
noun_phrase_interjection --> noun_compound,             subject_add,                             interjection_word(a),  separator(li).

subject                  --> pronoun_compound,          subject_add.
subject                  --> noun_compound,             subject_add.

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

verb_phrases             --> verb_phrase,         verb_phrase_add.
verb_phrase              --> verb_transitive_compound,                                       direct_objects,   prepositional_objects.
verb_phrase              --> verb_intransitive_compound,                                     intrans_objects,  prepositional_objects.
verb_phrase              --> adjectives_at_least_one,   adjectives.                                                                     % In toki pona is no verb "to be". 
verb_phrase              --> pronoun_compound.                                                                                          % In toki pona is no verb "to be".
verb_phrase              --> noun_compound.                                                                                             % In toki pona is no verb "to be". 
verb_phrase_add          --> [].
verb_phrase_add          --> separator(li),       verb_phrase,          verb_phrase_add.

question_yn_verb_phrase  -->                                                      verb_transitive(Verb),   adverb(ala), verb_transitive(Verb),   direct_objects, prepositional_objects.
question_yn_verb_phrase  --> verb_pre(Verb_pre), adverb(ala), verb_pre(Verb_pre), verb_transitive(Verb), { Verb \= Verb_pre },                   direct_objects, prepositional_objects.
question_yn_verb_phrase  --> verb_pre(Verb_pre), adverb(ala), verb_pre(Verb_pre),                                                                direct_objects, prepositional_objects.
question_yn_verb_phrase  -->                                                      verb_intransitive(Verb), adverb(ala), verb_intransitive(Verb), intrans_objects.
question_yn_verb_phrase  --> verb_pre(Verb_pre), adverb(ala), verb_pre(Verb_pre), verb_intransitive(Verb), { Verb \= Verb_pre },                 intrans_objects.

la_phrases               --> [].                                                                                                       % no "la" phrase
la_phrases               --> la_phrase. 
la_phrases               --> la_phrase, la_phrase.
la_phrase                --> noun_compound,                          comma_optional,    separator(la),      comma_optional.            % ...     la (,)
la_phrase                --> noun_phrase,          verb_phrases,     comma_optional,    separator(la),      comma_optional.            % ... (,) la (,)
la_phrase_follow         --> comma_optional,    separator(la),       comma_optional,    noun_compound.                                 % la phrase at the end of a sentences.
la_phrases_question      --> question,                               comma_optional,    separator(la),      comma_optional.            % A question as a "la" phrase.


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

direct_objects           --> [].                                                                                                        % no direct object
direct_objects           --> direct_object,       direct_objects.   
direct_object            --> separator(e),        noun_compound,          object_optional_add. 
direct_object            --> separator(e),        pronoun_compound,       object_optional_add.

intrans_objects         --> [].      
intrans_objects         --> intrans_object.
intrans_object          --> noun_compound,                                object_optional_add.                 
intrans_object          --> pronoun_compound,                             object_optional_add.                  

prepositional_objects   --> [].                       
prepositional_objects   --> prepositional_object, prepositional_objects.
prepositional_object    --> comma_optional,       preposition(_),       noun_compound,          object_optional_add.
prepositional_object    --> comma_optional,       preposition(_),       pronoun_compound,       object_optional_add.

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


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

pronoun_optional        --> [].
pronoun_optional        --> pronoun(_).

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


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

noun_compound           --> noun_compound_geography,                      noun_pi_groups.                                            % The special rules have to be before the general rules.
noun_compound           --> noun_compound_language,                       noun_pi_groups.
noun_compound           --> noun_compound_ideology,                       noun_pi_groups.
noun_compound           --> noun_compound_person,                         noun_pi_groups.
noun_compound           --> noun_compound_community,                      noun_pi_groups.
noun_compound           --> noun_compound_movie,                          noun_pi_groups.
noun_compound           --> noun(_),                     adjectives,      noun_pi_groups.                                            % 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_group.
noun_pi_groups          --> noun_pi_group,  noun_pi_group.
noun_pi_groups          --> noun_pi_group,  noun_pi_group,  noun_pi_group.                                                           % A noun can have up to three pi-phrase 


noun_pi_group           --> separator(pi),  noun(_),                  adjectives_at_least_one,       adjectives,                 noun_second_group_add.    % after "pi" have to be at least two words.
noun_pi_group           --> separator(pi),  noun(_),                                                 adjectives,    pronoun(_),  noun_second_group_add.    
noun_pi_group           --> separator(pi),  pronoun(_),               adjectives_at_least_one,       adjectives,                 noun_second_group_add. 
noun_pi_group           --> separator(pi),  pronoun(_),               adjectives_at_least_one,       adjectives,                 noun_second_group_add. 

noun_pi_group           --> separator(pi),  noun_compound_geography,                                                 noun_second_group_add.
noun_pi_group           --> separator(pi),  noun_compound_language,                                                  noun_second_group_add.
noun_pi_group           --> separator(pi),  noun_compound_ideology,                                                  noun_second_group_add.
noun_pi_group           --> separator(pi),  noun_compound_person,                                                    noun_second_group_add.
noun_pi_group           --> separator(pi),  noun_compound_community,                                                 noun_second_group_add.

noun_pi_group           --> separator(pi),  noun(_),                             conjunction(en), noun_compound,     noun_second_group_add.    % after "pi" have to be at least two words.
noun_pi_group           --> separator(pi),  noun(_),                             conjunction(en), pronoun_compound,  noun_second_group_add.    % after "pi" have to be at least two words.
noun_pi_group           --> separator(pi),  pronoun(_),                          conjunction(en), noun_compound,     noun_second_group_add.    % after "pi" have to be at least two words.
noun_pi_group           --> separator(pi),  pronoun(_),                          conjunction(en), pronoun_compound,  noun_second_group_add.    % after "pi" have to be at least two words.

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

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

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

% noun_compound_misc      --> noun(_),                      unofficial_words_miscellaneous(_), adjectives.

noun_compound_movie     --> noun(sitelen), adjectiv(tawa), movies(_),                       adjectives.


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

verb_transitive_compound   --> verb_pre_optional,   adverbs,   verb_transitive(_),      adverbs.

verb_intransitive_compound --> verb_pre_optional,   adverbs,   verb_intransitive(_),    adverbs.

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


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

adjectives              --> adjectives_pure,     pronoun_optional,                  numbers_optional,        pronoun_optional,   adjective_final.
adjectives              --> adjectives_pure,     unofficial_words_miscellaneous(_), numbers_optional,        pronoun_optional,   adjective_final.

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

adjectives_at_least_one --> adjectiv(_). 
adjectives_at_least_one --> numeral(_).

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


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

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




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

conjunctions            --> [].
conjunctions            --> conjunction(_), comma_optional.                                                                                     % But I hate commas!


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

numbers_optional        --> [].
numbers_optional        --> numbers.

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

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

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

count_system_1_2_5      --> numeral(wan).                                                                                               %  1                                  
count_system_1_2_5      --> numeral(tu).                                                                                                %  2                                 
count_system_1_2_5      --> numeral(tu),    numeral(wan).                                                                               %  3                 
count_system_1_2_5      --> numeral(tu),    numeral(tu).                                                                                %  4                
count_system_1_2_5      --> numeral(luka),  number_radix_5,  number_digits_5.                                                           %  5, ...
number_radix_5          --> []. 
number_radix_5          --> numeral(luka),  number_radix_5.                                                                             % luka, luka, luka, ...
number_digits_5         --> [].                                                                                                         % + 0
number_digits_5         --> numeral(wan).                                                                                               % + 1
number_digits_5         --> numeral(tu).                                                                                                % + 2
number_digits_5         --> numeral(tu),    numeral(wan).                                                                               % + 3
number_digits_5         --> numeral(tu),    numeral(tu).                                                                                % + 4

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

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

count_system_vague      --> adjectiv(mute).                                                                                             % vague numbers
count_system_vague      --> adjectiv(mute),        adjectiv(kin).                                                                       % mute kin
count_system_vague      --> adjectiv(mute),        adjectiv(mute).                                                                      % mute mute
count_system_vague      --> adjectiv(mute),        adjectiv(mute),       adjectiv(mute).                                                % mute mute mute
count_system_vague      --> adjectiv(lili).                                                                                             % lili
count_system_vague      --> adjectiv(lili),        adjectiv(kin).                                                                       % lili kin
count_system_vague      --> adjectiv(lili),        adjectiv(lili).                                                                      % lili lili
count_system_vague      --> adjectiv(lili),        adjectiv(lili),       adjectiv(lili).                                                % lili lili lili
count_system_vague      --> adjectiv(mute),        adjectiv(lili).                                                                      % mute lili
count_system_vague      --> adjectiv(lili),        adjectiv(mute).                                                                      % lili mute


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

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

interjection_optional  --> [].
interjection_optional  --> interjection_word('a').


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

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
     ijo,          % of something
     ike,          % bad, negative, wrong, evil, overly complex, (figuratively) unhealthy
     insa,         % inner, internal
     jaki,         % dirty, gross, filthy
     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
     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
     luka,         % tactile
     lukin,        % visual(ly)
     ma,           % countrified, outdoor, alfresco, open-air
     mama,         % of the parent, parental, maternal, fatherly
     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
     nena,         % hilly, undulating, mountainous, hunchbacked, humpbacked, bumpy
     olin,         % love
     open,         % initial, starting, opening
     pakala,       % destroyed, ruined, demolished, shattered, wrecked
     pali,         % active, work-related, operating, working
     pana,         % generous
     pilin,        % sensitive, feeling, empathic
     pimeja,       % black, dark
     pini,         % ago, completed, ended, finished, past, done
     poka,         % neighbouring
     pona,         % good, simple, positive, nice, correct, right
     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
     suwi,         % sweet, cute
     sike,         % round, cyclical, of one year
     sin,          % afresh, anew, in turn, 
     sinpin,       % vertical
     suli,         % big, tall, long, adult, important
     suno,         % sunny, sunnily
     supa,         % flat, shallow, flat-bottomed
     tan,          % causal, 
     taso,         % only, sole
     tawa,         % moving, mobile
     telo,         % wett, slobbery, moist, damp, humid, sticky, sweaty, dewy, drizzly
     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], { 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
     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
     musi,         % cheerfully
     mute,         % many, very, much, several, a lot, abundant, numerous, more
     mu,           % animal nois-
     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
     sike,         % rotated
     sijelo,       % physically, bodily
     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
     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], { member(Conjunction, [
     anu,          % or (used for decision questions)
     en,           % and (used to coordinate head nouns)
     taso          % but, however
 ])
}.

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], { 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
     jan,          % person, people, human, being, somebody, anybody
     jelo,         % yellow, light green
     jo,           % having
     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
     lon,          % existence, being, presence
     lete,         % cold, chill, bleakness
     lili,         % smallness, youth, immaturity
     linja,        % long and flexible thing; string, rope, hair, thread, cord, chain, line, yarn
     lipu,         % paper, card, ticket, sheet, page, flat and bendable thing
     loje,         % red
     luka,         % arm, hand, tacticle organ
     lupa,         % hole, orifice, door, window
     lukin,        % view, look, glance, sight, gaze, glimpse, seeing, vision, sight 
     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
     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], { 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], { 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], { 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], { member(Question_word, [
	seme           % what, which, wh- (question word)
 ])
}.

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

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

verb_pre(Verb_pre) --> [Verb_pre], { member(Verb_pre, [
     kama,         % to become, to mange to
     ken,          % can, may
%     kin,          % also, still
     lukin,        % to seek to, try to, look for
     sona,         % to know how to
     wile          % to want, need, wish, have to, must, will, should
 ])
}.


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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.pro']. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

% Sentences with right grammar:

ken la tenpo pimeja la ni li pona.
ken la ilo li pakala.
ken la jan Lisa li jo e ona. 
ken la ona li lape.
ken la mi ken tawa ma Elopa.
tenpo pini la mi weka.
tenpo ni la mi lon.
tenpo kama la mi lape. 
tenpo pimeja pini la mi kama nasa.
tenpo pi mute seme la sina sike e suno?
tenpo tu tu la mi sike e suno.
mama mi li moli la mi pilin ike.
mi lape la ali li pona. 
sina moku e telo nasa la sina nasa.
sina moli la sina ken ala toki. 
mi pali mute la mi pilin ike.
ken la tenpo pimeja la ni li pona.
mi pali mute, la mi pilin ike.
jan Lisa li pona mute. 
jan Susan li pona lili.
ken la jan Susan li kama.
tenpo pimeja pini la mi lukin e sitelen tawa X-Files.
jan ike li kama la o seli e lipu ni.
ken la ona li lon tomo sona.
tenpo suno kama la mi wile pali.
seli li lon la mi pana e telo tan selo mi.
o open e lupa.
tenpo pimeja ni la mun li suli.
ken la jan lili li wile moku e telo. 	  	 
tenpo ali la o kama sona! 	  	 
sina sona e toki ni la sina sona e toki pona!
tenpo kama la sina wile ala wile moku?
tomo pi mute seme li lon?
tan seme la soweli wawa pimeja li moku e ona?
mama sina li kama lon tenpo seme?
tenpo seme la mama sina li kama?
taso sina ken kin kama sona e ijo sin.
nimi pi ijo pona ni li Konipute. 
sina jo e ilo MIRC la o pilin e nena ni.
sina lukin e nena Proceed la o pilin e ona.
sina jo ala e ilo MIRC la sina ken pali e ijo tu: sina ken kama jo e ilo MIRC.
jan ike Kin li pakala e tenpo pona Kolisu!
jan ike Kin li wile pakala e tenpo pona Kolisu.
soweli Kipa li lili.
tenpo suno pi jan moli li pona tawa soweli Kipa.
ken la sina pilin e ni: mi toki e lon ala.
taso mi pilin e ni: mi toki e lon.
tenpo li pini la pipi en soweli en ijo sin mute li kama: ijo mute li moli.
o lukin e sitelen ni: jan li lon!
meli pona o a!
meli mi o, mi olin e sina!
nimi mi li Nikita.
lon la toki pona li lili.
waso ike li tawa sike lon lawa mi.
telo pimeja ni li telo loje mi li ale mi.
jan Kolonpo li tawa ma tomo Lisapon.
ona li tawa kin ma Elopa mute kepeken tomo tawa telo.
taso ni li ike: jan li wile tawa ma Asija la ona li tawa mute mute.

jan Kolonpo li jo e tomo tawa Ninja e tomo tawa Pinta e tomo tawa Santamalija.
pona mute!
pona mute mute!
pona mute mute mute!
wile sona li mute e sona.
nasin mani li ike.
tenpo li sijelo e sijelo ike ale.
jan Kolonpo li toki e ni: mi wile ala tawa lon poka pi ma Apika.
jan Kolonpo li tawa jan lawa pi ma Potuke li toki e ni: mi ken tawa ma Asija kepeken nasin ante.
jan Pusin pi ma Losi li moli e jan mute kin li ike mute kin!
moku ni li jo e namako mute!
o kipisi e linja tu ni.
ona li kin tawa ma Elopa mute kepeken tomo tawa telo.
mi wile tawa la tenpo ni. 
ma sin ni li pona li jo e musi ala pini.
ken la sina wile kama kin.  
o kute e mi! 
o tawa la tenpo kama lili. 
mi jo ala e mani. 
taso mi wile e ni: sina wile kama kin.

mi wile tawa ma ante.
ma sin li pona tan ni: mi wile tawa ma ante.
ma sin li pona tan ni: jan li pilin e seli. 
jan li pilin e olin.

sike tu li pona li pona tawa mi li pona tawa ma.

% Wrong grammar:

?- check_grammar.
|: taso sina kin ken kama sona e ijo sin.
false.

?- check_grammar.
|: tenpo pi mute seme?  
false.

?- check_grammar.
|: ona li tomo pi toki pona en pi nanpa wan!

?- check_grammar.
|: telo pimeja ni li telo loje mi, li ale mi.

?- check_grammar.
|: jan Kolonpo li tawa ma tomo Lisbon.

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

?- check_grammar.
|: mi ken ala weka pi tan lawa e ni: insa nasin la kiwen li lon.
false.

?- check_grammar.
|: jan li soweli e sama la ona li weka e ike jan.
false.

?- check_grammar.
|: anu ike pilin?
false.



*/









Include Files for Unofficial Words

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

unofficial_words_miscellaneous_catalog(Unofficial_words_miscellaneous_catalog) --> [Unofficial_words_miscellaneous_catalog], { member(Unofficial_words_miscellaneous_catalog, [  
     'MIRC',               % Internet tool "mIRC"           
     'Proceed'             % Button "Proceed"
 ])
}.

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eof
Download swi-prolog | Download these scripts | My langugage Projects on Github

 


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