Toki Pona is a linguist's code golf: A minimalist language with a vocabulary of around 120 words. Because of this, it has very few grammatical irregularities found in other languages, making it ideal for a code golf challenge.
Your task is to take the most simple form of a Toki Pona sentence and translate it into English, using the (even more) limited dictionary provided in this question.
While 120 words isn't a lot for a language, it's a lot of bytes. So, for that reason, I'm limiting the input to only contain these 20 words (English translation in brackets, Toki Pona in bold):
- Pronouns: mi (I/me), sina (you) and ona (he/she/it/him/her)
- Grammatical constructs: li and e
- Verbs: jo (to have), moku (to eat), pona (to fix), oko (to see) and wile (to want)
- Adjectives: pona (good/simple), ike (bad), wan (one/unique) and mute (many)
- Nouns: kili (fruit), oko (eye), jan (person/man/woman), moku (food), ilo (tool) and ijo (thing)
In addition, sentences involving the verb to be are included (expanded on later).
As you can see, simple sentences such as I want food can be made from this list: mi wile e moku. We'll address the exact grammatical construction in the next section. However, note that a single word may be used for multiple different English words (e.g. moku), which is how such a limited vocabulary is possible.
All of the sentences you'll be required to handle will have one of the following forms:
- pronoun/noun "li" verb
- e.g. ona li oko (he sees)
- pronoun/noun "li" pronoun/noun
- e.g. ona li jan (she is a person)
- pronoun/noun "li" noun adjective
- e.g. ona li ijo ike (it is a bad thing)
- pronoun/noun "li" verb "e" pronoun/noun
- e.g. jan li jo e kili (the person has fruit)
- pronoun/noun "li" verb "e" noun adjective
- e.g. jan li jo e kili pona (the person has good fruit)
We'll call the first pronoun/noun the subject of the sentence and the second the object. Notice that the adjective comes after the noun, not before, and that pronouns cannot be paired with adjectives.
For example, ona li moku e moku (He eats food) is of the fourth form. However, the one exception is that if the subject is mi (I/me) or sina (you), then li is omitted. So mi moku e moku would translate as I eat food.
You'll notice that forms 2 and 3 don't have a verb, but our translated examples do. This is because Toki Pona has no word for to be. While we would say "I am good", Toki Pona speakers would say mi pona instead (omitting the verb). If the subject is not mi or sina, then li is used as it would be usually: kili li moku.
The two constructs li and e are used in the following ways:
- If the pronoun preceding is not mi or sina, the verb in the sentence is preceded by li. For example, moku li moku or ona li oko
- The object in the sentence is always preceded by e. For example, moku li moku e moku or mi pona e ilo mute.
Notice that Toki Pona doesn't conjugate verbs, nor does it change the word when plural. Due to this, you should assume that all input is in the singular (ijo is translated as thing, not things)
In comparison, all outputted sentences should be in the forms
- pronoun/noun verb
- pronoun/noun verb pronoun/noun
- pronoun/noun verb adjective pronoun/noun
As each word has multiple translations (ona is he, she or it), we'll use these translations:
mi (subject) -> I mi (object) -> me sina -> you ona (subject) -> he ona (object) -> him jo -> to have moku (verb) -> to eat moku (noun) -> food pona (verb) -> to fix pona (adjective) -> good oko (verb) -> to see oko (noun) -> eye wile -> to want ike -> bad wan -> one mute -> many kili -> fruit jan -> person ilo -> tool ijo -> thing
However, because English has plenty of grammatical irregularities, and we have such a small vocabulary list, the English output should be as accurate as possible. Therefore:
- Verbs in English are to be conjugated. This means that for all verbs except to be:
- The I and you forms are the same as the infinitive (to fix -> I fix, you fix etc.)
- The he form (which includes nouns) modifies the infinitive to end with an
s. Specfically, the 5 verbs become has, eats, fixes, sees and wants respectively.
- For to be, I becomes am, you becomes are and he (including nouns) become is
- Nouns are prefixed with a
the(notice the space), unless the adjective after it is wan (one) or mute (many).
- Nouns before mute (many) should have a trailing
s(yes even fruit and food). So ilo mute becomes many tools
You are to take in a single sentence of Toki Pona consisting of only words from those 20, and always in one of the forms listed above (including the to be exceptions), and output the English translation. As is standard in Toki Pona, input will always be lowercase.
You may take input where the separator is any consistent non-alphabetic character or sequence of characters, including spaces (i.e.
mi@@@e@@@jan is perfectly acceptable), or you may take input as a list of words, if you wish. The input does not have to make sense (e.g. ijo li jo e jan mute), but will always follow the grammatical rules.
Output rules are equally lax - you may output as a list of words, or as a single string with any consistent, non-alphabetical separator. Case is irrelevant.
This is code-golf so the shortest code in bytes wins!
mi wile e moku - I want the food mi moku e moku - I eat the food mi pona - I fix+ mi jan - I am the person ona li oko - He sees/He is the eye* ona li jan - He is the person ona li ijo ike - He is the bad thing jan li jo e kili - The person has the fruit jan li oko e kili pona - The person sees the good fruit kili li moku - The fruit is the food/The fruit eats* moku li moku - The food is the food/The food eats* moku li moku e moku - The food eats the food ijo li jo e jan mute - The thing has many persons ilo li pona e ijo - The tool fixes the thing sina moku e kili mute - You eat many fruits sina moku e kili ike - You eat the bad fruit oko li oko e mi - The eye sees me mi wile e sina - I want you jan li moku e ona - The person eats him mi jo e ijo wan - I have one thing mi jo e ijo mute - I have many things sina kili - you are the fruit *: Either translation is acceptable for output, as both are valid translations +: I am good would be the natural translation, but using pona as an adjective doesn't fix as one of our five forms, so is not a valid translation in this case