Describing Toki Pona with the computer language Prolog and DCG

Discuss any other topic in here.
Diskutu ĉiujn aliajn temojn ĉi tie.
jan_Lope
Posts: 141
Joined: Sat Apr 06, 2013 1:30 pm
Location: mi lon ma tomo Pelin.
Contact:

Describing Toki Pona with the computer language Prolog and DCG

Postby jan_Lope » Tue Oct 27, 2015 2:30 pm

toki!

With the Definite Clause Grammars (DCG) is it possible to describe a language. But this is not a simple thing because natural languages are not simple. DCG programs represent mostly only parts of a human language. My aim is to describe a complete language. This language has to be very simple because I am not a genius. For example Esperanto is not simple enough (for me ;-). I hope toki pona is simple enough for my aim. I write Prolog scripts to describe the grammar rules of every of my toki pona lessons.

DCG notation is syntactic sugar for normal definite clauses of Prolog. Prolog is an old programming language for artificial intelligence. Prolog is different to the most programming languages. You don't have to program the solution for a problem. You describe the situation and Prolog tries to find the solution. For Prolog it's better if you have not experiences in other programming languages. ;-)

But what can you do with this?

You can check the grammar of a Toki Pona sentence:

Here a sentences with right grammar:

?- check_grammar.
|: tomo tawa sina li pakala ala pakala?
true

Here a sentences with wrong grammar:

?- check_grammar.
|: sina wile ala mute moku?
false

http://rowa.giso.de/languages/toki-pona/dcg/
pona!
jan Lope
http://rowa.giso.de/languages/toki-pona/ (Lessons)
http://rowa.giso.de/languages/toki-pona/dcg/ (Prolog and DCG)

On my foe list are the sockpuppets janKipo and janSilipu because of spamming.

janKipo
Posts: 2744
Joined: Fri Oct 09, 2009 2:20 pm

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby janKipo » Thu Oct 29, 2015 10:14 am

but 'sina wile ala mute moku?' is grammatical (with a small doubt about the question mark because the informal questions, while allowed, are not well documented or regulated).

jan_Lope
Posts: 141
Joined: Sat Apr 06, 2013 1:30 pm
Location: mi lon ma tomo Pelin.
Contact:

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby jan_Lope » Thu Oct 29, 2015 10:37 am

The grammar of the question 'sina wile ala mute moku?' is wrong. A yes/no question with 'ala' the verbs before and after 'ala' have to be the same. Other question types need 'seme' or 'anu'.
pona!
jan Lope
http://rowa.giso.de/languages/toki-pona/ (Lessons)
http://rowa.giso.de/languages/toki-pona/dcg/ (Prolog and DCG)

On my foe list are the sockpuppets janKipo and janSilipu because of spamming.

janKipo
Posts: 2744
Joined: Fri Oct 09, 2009 2:20 pm

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby janKipo » Thu Oct 29, 2015 11:06 am

Yes, but it is possible to ask a y/n question by change of voice (probably upturn at the end) marked only by the question ark. So, since 'sina wile ala mute moku.' is an OK declaration, the same form with a different intonation is an OK question.

jan_Lope
Posts: 141
Joined: Sat Apr 06, 2013 1:30 pm
Location: mi lon ma tomo Pelin.
Contact:

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby jan_Lope » Thu Oct 29, 2015 3:29 pm

In Toki Pona a yes/no question need "ala" or "anu". As I wrote "ala" need the the same verb before and after it. Please see the grammar rules of Toki Pona.
pona!
jan Lope
http://rowa.giso.de/languages/toki-pona/ (Lessons)
http://rowa.giso.de/languages/toki-pona/dcg/ (Prolog and DCG)

On my foe list are the sockpuppets janKipo and janSilipu because of spamming.

User avatar
jan Pinsen
Posts: 51
Joined: Wed Feb 11, 2015 4:19 pm
Location: ma Netelan

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby jan Pinsen » Thu Oct 29, 2015 4:20 pm

I think jan Kipo is correct. That said, I do wonder about the interpretation of the sentence "sina wile ala mute moku?" even if a question like that is allowed. Since there's no "pi" between "wile" and "ala mute", "ala" and "mute" would apply to "wile" separately, right? So you want both 'not' and 'a lot'?

More importantly, incredibly interesting project! I hope to look into it further in the near future, when I am done with my exams.

janKipo
Posts: 2744
Joined: Fri Oct 09, 2009 2:20 pm

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby janKipo » Thu Oct 29, 2015 6:31 pm

Well, I wrote most of the formal grammars of tp and so know how much they leave out. I can't find the intonation point just now -- was it in Sonja or Pije or on the Forum? Anyhow, it is there. In any case, there are more grammatical sentences -- even more questions -- than those with a 'x ala x' verb.
The other point is messier. I suppose the English would be "Do you very much not want to eat" I am not sure what 'pi' would produce, since 'mute' directly modifying 'ala', rather than the other way around, is indeed pretty opaque. But 'mute' modifying 'wile ala', as here, is clear while unusual. ('ala' applies to 'wile', 'mute' applies to 'wile ala' -- left grouping always absent a 'pi')

User avatar
jan Pinsen
Posts: 51
Joined: Wed Feb 11, 2015 4:19 pm
Location: ma Netelan

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby jan Pinsen » Thu Oct 29, 2015 7:28 pm

Ah, of course, I always misinterpret when multiple words are modifying a given head word. It's just left associative in toki pona; I should remember it's that simple. So "mute" and "ala" don't individually modify "wile" (that would be a tricky tree structure anyway); first "ala" modifies "wile", and then "mute" modifies "wile ala". In that case it does indeed become more easily interpretable. My thanks.

jan_Lope
Posts: 141
Joined: Sat Apr 06, 2013 1:30 pm
Location: mi lon ma tomo Pelin.
Contact:

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby jan_Lope » Fri Oct 30, 2015 3:09 am

The discussion is going more and more off topic. The topic is "Describing Toki Pona with the computer language Prolog and DCG"!

I'm making DCG rules based on the lessons of my website and the official Toki Pona book. Sentences, which do not fit to these rules will be marked as "false". You can find more sentences with wrong grammar at the end of every DCG lesson in http://rowa.giso.de/languages/toki-pona/dcg/ and I can give you a lot more examples with wrong grammar if you like.

I'm open minded for suggestions to improve these DCG rules. But discussions with "May be .." or "It could be ..." don't help. Toki Pona is often very ambiguous. Only clear grammar rules can avoid this.

Please let me know if these DCG rules don't fit to official grammar rules of Toki Pona.

Thanks
pona!
jan Lope
http://rowa.giso.de/languages/toki-pona/ (Lessons)
http://rowa.giso.de/languages/toki-pona/dcg/ (Prolog and DCG)

On my foe list are the sockpuppets janKipo and janSilipu because of spamming.

janKipo
Posts: 2744
Joined: Fri Oct 09, 2009 2:20 pm

Re: Describing Toki Pona with the computer language Prolog and DCG

Postby janKipo » Fri Oct 30, 2015 12:12 pm

Well, this is an impressive mass of work (your note makes it sound like a project, not a mainly completed reality). In any case, here are the problem cases (astonishingly few), many of them the result of relatively recent changes which have not been accepted in all dialects, but are close to the community consensus. There are a couple of cases still up in the air as well.

2: 'mi moku li pakala li pakala' is OK

3 'mi moku e moku mute mute mi' ? marginal, nice to have a hard datum

4 ('mi kepeken e poki mi', 'mi kepeken e ilo') listed as OK but not: no 'e' with 'kepeken'

6 'sina wile toki e tan tawa mi' grammatical but possibly inappropriate (“talk about”?) not sure how to sort these out
All the rejects here are at most punctuation matters, questionable question marks and definitely wrong period.

7 'Linnula' is not proper spelling final /n/ can't be before initial /n/ or /m/.
'mi wile wile e ni: mi lon' is OK, the others just lack the 'e' (and even that may be permissible in some contexts)

8 'ma Elopa/ma tomo Pelin lon seme' lack 'li' – not grammatical
'ni li lili li suli tawa sina?' is just questionable question mark.
'Alipe Eintein' is not an unofficial word – no VVs allowed.

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).

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')
settled but still disputed: 'mi kin' requires 'li' so 'mi kin olin e sina' is ungrammatical.
I didn't see a case, but can a sentence contain 'anu' and not be a question?

11 Yeah, titles are a problem. This seems to be going in the right way (I prefer all have quotes, like untpized foreign words).

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.

14 As earlier 'jan mute mute mute li kama' is questionable on various grounds. Any sensible reading requires at least one 'pi', but ….
'ni li jan lili ona pi nanpa tu' is ungrammatical – no 'pi' with 'nanpa'
'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).

15 And, if you must use a comma with 'la', it goes after the 'la'.
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”).
'ken la tenpo pimeja la ni li pona' is clearly grammatical,
I don't now understand your use of unofficial unofficial words, like 'X-Files' and 'MIRC' but not “Lisbon”.
I'm also wondering about rejecting a sentence because of a (moderately appropriate) comma.


Return to “ijo ante | miscellaneous | diversaj”

Who is online

Users browsing this forum: No registered users and 1 guest