Re: Describing Toki Pona with the computer language Prolog and DCG
Posted: Wed Nov 04, 2015 7:01 am
jan Kipo, many thanks for your notes.
This project is just for fun and not completed. Maybe it will be never completed (Perfectionism is boring
At the moment I can't support Toki Pona dialects. First I try to apply the official grammar rules of jan Sonja and jan Pije. But the DCG rules are not set in stone. May these DCG rules can help to improve Toki Pona lessons.
> 2: 'mi moku li pakala li pakala' is OK
In the beginning I made a nice mistake and I didn't realize this until know. I 've fixed it.
?- check_grammar.
|: mi moku li pakala li pakala.
true .
> 3 'mi moku e moku mute mute mi' ? marginal, nice to have a hard datum
Do you mean the number of "mute"? I've limited it to 3.
?- check_grammar.
|: mi moku e moku mute mute mute.
true .
?- check_grammar.
|: mi moku e moku mute mute mute mute.
false.
The DCG rules for adjectives and adverbs are not optimal now. I think more than 4 adjectives or adverbs are not good to understand and no Toki Pona style.
Pronouns can be adjectives but on which position - only at the end of several adjectives?
> 4 ('mi kepeken e poki mi', 'mi kepeken e ilo') listed as OK but not: no 'e' with 'kepeken'
In the lessons of jan Pije is "kepeken" a transitive verb also.
http://tokipona.net/tp/janpije/okamasona6.php
> 6 'sina wile toki e tan tawa mi' grammatical but possibly inappropriate (“talk about”?) not sure how to sort these out
See http://tokipona.net/tp/janpije/okamasona8.php "Practice"
> All the rejects here are at most punctuation matters, questionable question marks and definitely wrong period.
Note: I 've created the most of the examples with wrong grammar to check the DCG rules.
> 7 'Linnula' is not proper spelling final /n/ can't be before initial /n/ or /m/.
There is no rule about this in the official Toki pona book. But here: http://tokipona.net/tp/janpije/okamasona2.php
I'll correct the Prolog-DCG-rules next.
> 'mi wile wile e ni: mi lon' is OK, the others just lack the 'e' (and even that may be permissible in some contexts)
At the moment my DCG rules do not allow to repeat the same verb several times. I think it makes no sense. You can use "mute" or "kin" instead. Maybe I'm wrong.
> 8 'ma Elopa/ma tomo Pelin lon seme' lack 'li' – not grammatical
Bugfix:
?- check_grammar.
|: ma Elopa lon seme?
false.
?- check_grammar.
|: ma tomo Pelin lon seme?
false.
> 'ni li lili li suli tawa sina?' is just questionable question mark.
Yes, it is.
> 9 Contentious issue: can unofficial words stand alone as predicate, e.g. 'nimi mi li Kipo' Reason and the general rules say “No”, pu says “Yes” and you follow pu, thus furthering the spread of nonsense (and bad rule use).
Yes, it is a contentious issue. jan Sonja and jan Pije say "Yes". I prefer "No", but I build DCG rules in accordance with the official Toki Pona.
> 10 about the limits of grammar: 'lipu ni li pilin lete' is wrong because 'pilin' (like 'olin', etc.) only takes sentient subjects, which 'lipu' probably is not. But is this grammatical or something else? (I suppose it intends 'lete pilin')
Not "lipu" has the feeling. Please see http://tokipona.net/tp/janpije/okamasona12.php
> settled but still disputed: 'mi kin' requires 'li' so 'mi kin olin e sina' is ungrammatical.
In the past "kin" was used as pre verb and it needs no "li" here. In jan Pijes lessons is "kin" an adjectiv now. I changed the DCG rules and the Toki Pona lessons on my website:
?- check_grammar.
|: mi kin olin e sina.
false.
?- check_grammar.
|: mi kin li olin e sina.
true .
?- check_grammar.
|: mi olin kin e sina.
true .
> I didn't see a case, but can a sentence contain 'anu' and not be a question?
mi kute e mije anu meli. (pu lession 7).
> 11 Yeah, titles are a problem. This seems to be going in the right way (I prefer all have quotes, like untpized foreign words).
I think you mean titles of movies ("sitelen tawa").
Btw: Titles of text sections are often no complete sentences. To recognize these kind of titles you have to check not only one sentence. This is a aim for later.
> 12 'akesi mu li tawa' is borderline. Those who use 'mu' and 'a' as verbs and nouns (and, hence, modifiers) say it is fine; otherwise not.
"mu" could be a verb or a noun? I've found no notes about this in jan Sonas and jan Pijes lessons.
> 14 As earlier 'jan mute mute mute li kama' is questionable on various grounds. Any sensible reading requires at least one 'pi', but ….
Where do you found this rule?
> 'ni li jan lili ona pi nanpa tu' is ungrammatical – no 'pi' with 'nanpa'
Please see http://tokipona.net/tp/janpije/okamasona16.php
> 'ni li jan tu tu tu tu' is clearly OK, since officially there are only 'wan' and 'tu' as numbers; the use of 'luka', etc. is officially optional (or even discouraged).
Please see pu page 46.
> 15 And, if you must use a comma with 'la', it goes after the 'la'.
Please see pu page 52.
> The multiple 'mute' problem again. No clear solution in sight, but the old rules would allow at most two 'mute' in a row without a 'pi' (one “very” and one “many”).
If I see clear rules for this I 'll adapt the DCG rules.
> 'ken la tenpo pimeja la ni li pona' is clearly grammatical,
Several "la" in one sentence are OK?
> I don't now understand your use of unofficial unofficial words, like 'X-Files' and 'MIRC' but not “Lisbon”.
This if only a software issue at the moment. My scripts are using include files ("unofficial_words_*_catalog.pro") with hard coded unoffical word like "X-Files". If Prolog can't find the word in these include files it check the spelling with DCG rules.
"Lisbon" is not in the include files and has the wrong spelling.
> I'm also wondering about rejecting a sentence because of a (moderately appropriate) comma.
I try to fit the DCG rules to the lessons of jan Sonja and jan Pije.
This project is just for fun and not completed. Maybe it will be never completed (Perfectionism is boring
At the moment I can't support Toki Pona dialects. First I try to apply the official grammar rules of jan Sonja and jan Pije. But the DCG rules are not set in stone. May these DCG rules can help to improve Toki Pona lessons.
> 2: 'mi moku li pakala li pakala' is OK
In the beginning I made a nice mistake and I didn't realize this until know. I 've fixed it.
?- check_grammar.
|: mi moku li pakala li pakala.
true .
> 3 'mi moku e moku mute mute mi' ? marginal, nice to have a hard datum
Do you mean the number of "mute"? I've limited it to 3.
?- check_grammar.
|: mi moku e moku mute mute mute.
true .
?- check_grammar.
|: mi moku e moku mute mute mute mute.
false.
The DCG rules for adjectives and adverbs are not optimal now. I think more than 4 adjectives or adverbs are not good to understand and no Toki Pona style.
Pronouns can be adjectives but on which position - only at the end of several adjectives?
> 4 ('mi kepeken e poki mi', 'mi kepeken e ilo') listed as OK but not: no 'e' with 'kepeken'
In the lessons of jan Pije is "kepeken" a transitive verb also.
http://tokipona.net/tp/janpije/okamasona6.php
> 6 'sina wile toki e tan tawa mi' grammatical but possibly inappropriate (“talk about”?) not sure how to sort these out
See http://tokipona.net/tp/janpije/okamasona8.php "Practice"
> All the rejects here are at most punctuation matters, questionable question marks and definitely wrong period.
Note: I 've created the most of the examples with wrong grammar to check the DCG rules.
> 7 'Linnula' is not proper spelling final /n/ can't be before initial /n/ or /m/.
There is no rule about this in the official Toki pona book. But here: http://tokipona.net/tp/janpije/okamasona2.php
I'll correct the Prolog-DCG-rules next.
> 'mi wile wile e ni: mi lon' is OK, the others just lack the 'e' (and even that may be permissible in some contexts)
At the moment my DCG rules do not allow to repeat the same verb several times. I think it makes no sense. You can use "mute" or "kin" instead. Maybe I'm wrong.
> 8 'ma Elopa/ma tomo Pelin lon seme' lack 'li' – not grammatical
Bugfix:
?- check_grammar.
|: ma Elopa lon seme?
false.
?- check_grammar.
|: ma tomo Pelin lon seme?
false.
> 'ni li lili li suli tawa sina?' is just questionable question mark.
Yes, it is.
> 9 Contentious issue: can unofficial words stand alone as predicate, e.g. 'nimi mi li Kipo' Reason and the general rules say “No”, pu says “Yes” and you follow pu, thus furthering the spread of nonsense (and bad rule use).
Yes, it is a contentious issue. jan Sonja and jan Pije say "Yes". I prefer "No", but I build DCG rules in accordance with the official Toki Pona.
> 10 about the limits of grammar: 'lipu ni li pilin lete' is wrong because 'pilin' (like 'olin', etc.) only takes sentient subjects, which 'lipu' probably is not. But is this grammatical or something else? (I suppose it intends 'lete pilin')
Not "lipu" has the feeling. Please see http://tokipona.net/tp/janpije/okamasona12.php
> settled but still disputed: 'mi kin' requires 'li' so 'mi kin olin e sina' is ungrammatical.
In the past "kin" was used as pre verb and it needs no "li" here. In jan Pijes lessons is "kin" an adjectiv now. I changed the DCG rules and the Toki Pona lessons on my website:
?- check_grammar.
|: mi kin olin e sina.
false.
?- check_grammar.
|: mi kin li olin e sina.
true .
?- check_grammar.
|: mi olin kin e sina.
true .
> I didn't see a case, but can a sentence contain 'anu' and not be a question?
mi kute e mije anu meli. (pu lession 7).
> 11 Yeah, titles are a problem. This seems to be going in the right way (I prefer all have quotes, like untpized foreign words).
I think you mean titles of movies ("sitelen tawa").
Btw: Titles of text sections are often no complete sentences. To recognize these kind of titles you have to check not only one sentence. This is a aim for later.
> 12 'akesi mu li tawa' is borderline. Those who use 'mu' and 'a' as verbs and nouns (and, hence, modifiers) say it is fine; otherwise not.
"mu" could be a verb or a noun? I've found no notes about this in jan Sonas and jan Pijes lessons.
> 14 As earlier 'jan mute mute mute li kama' is questionable on various grounds. Any sensible reading requires at least one 'pi', but ….
Where do you found this rule?
> 'ni li jan lili ona pi nanpa tu' is ungrammatical – no 'pi' with 'nanpa'
Please see http://tokipona.net/tp/janpije/okamasona16.php
> 'ni li jan tu tu tu tu' is clearly OK, since officially there are only 'wan' and 'tu' as numbers; the use of 'luka', etc. is officially optional (or even discouraged).
Please see pu page 46.
> 15 And, if you must use a comma with 'la', it goes after the 'la'.
Please see pu page 52.
> The multiple 'mute' problem again. No clear solution in sight, but the old rules would allow at most two 'mute' in a row without a 'pi' (one “very” and one “many”).
If I see clear rules for this I 'll adapt the DCG rules.
> 'ken la tenpo pimeja la ni li pona' is clearly grammatical,
Several "la" in one sentence are OK?
> I don't now understand your use of unofficial unofficial words, like 'X-Files' and 'MIRC' but not “Lisbon”.
This if only a software issue at the moment. My scripts are using include files ("unofficial_words_*_catalog.pro") with hard coded unoffical word like "X-Files". If Prolog can't find the word in these include files it check the spelling with DCG rules.
"Lisbon" is not in the include files and has the wrong spelling.
> I'm also wondering about rejecting a sentence because of a (moderately appropriate) comma.
I try to fit the DCG rules to the lessons of jan Sonja and jan Pije.