Uilta is a minority tungusic language spoken in the far east of Russia.
A neat thing about Uilta is that it has pitch accent which can be predicted by a computer program. In this challenge we are going to take Uilta a word and determine where the accent peak is.
Let me explain how this can be done.
The first thing needed is to split the input into phonemes. Phonemes are the smallest unit of language and they consist of vowels and consonants.
We will be using XSAMPA for this challenge so a vowel in Uilta is any of the following characters:
A consonant is any of the following characters:
Additionally the digraphs
dZ count as single consonants. Every input will have a unique decomposition into phonemes. So you don't have to worry about handling bad input.
Here are some example words split into phonemes:
na4i -> n a 4 i mOO -> m O O tuN@ndZi -> t u N @ n dZ i ilaa -> i l a a patala -> p a t a l a xamdatta -> x a m d a t t a @@kt@ -> @ @ k t @ isaaptu -> i s a a p t u dZakpu -> dZ a k p u bitSix@ -> b i tS i x @ xaiwaddaa -> x a i w a d d a a
Each word in Uilta can be broken into syllables. Syllables give the rhythm of the word. Syllables in Uilta match the regex
C matches any consonant and
V matches any vowel.
There is one further restriction: Only the first syllable may begin with a vowel.
Every input will have a unique decomposition into valid syllables.
Here are some example words split into syllables:
na4i -> na.4i mOO -> mOO tuN@ndZi -> tu.N@n.dZi ilaa -> i.laa patala -> pa.ta.la xamdatta -> xam.dat.ta @@kt@ -> @@k.t@ isaaptu -> i.saap.tu dZakpu -> dZak.pu bitSix@ -> bi.tSi.x@ xaiwaddaa -> xai.wad.daa
Each syllable is made up of 1-3 smaller units called "morae". The first mora is all of the syllable up to and including the first vowel, this forms the primary mora. Every other letter in the syllable is its own mora, these are secondary morae.
Every input will have a unique decomposition into at least two valid morae.
Here are some example words split into syllables with
. and morae with
na4i -> na.4i mOO -> mO O tuN@ndZi -> tu.N@ n.dZi ilaa -> i.la a patala -> pa.ta.la xamdatta -> xa m.da t.ta @@kt@ -> @ @ k.t@ isaaptu -> i.sa a p.tu dZakpu -> dZa k.pu bitSix@ -> bi.tSi.x@ xaiwaddaa -> xa i.wa d.da a
Once you've split the word up into morae you can determine where the accent peak is.
The process is as follows:
- Check the second to last mora. If it's a primary mora then it's the accent peak. If it's not ...
- Check the mora preceding it. If it's a primary mora then it's the accent peak. If it's not ...
- The mora preceding it is the accent peak. (It must be a primary mora)
na4i -> na mOO -> mO tuN@ndZi -> N@ ilaa -> la patala -> ta xamdatta -> da @@kt@ -> @ isaaptu -> sa dZakpu -> dZa bitSix@ -> tSi xaiwaddaa -> da
Given a valid Uilta word output its accent peak mora. Input will always be valid as described above.
This is code-golf so your goal is to minimize the size of your source code as measured in bytes.
If you want to read more about the Uilta language the following is an excellent resource and was invaluable for creating this challenge: