16
1
Challenge
Given a word in Welsh, output all of the possible mutated forms of the word.
Mutations
A mutation is a change of the first letter of a word when following certain words or in certain grammatical contexts.
In Welsh, the following are considered "consonants":
b c ch d dd f ff g ng h l ll m n p ph r rh s t th
Note that multiple character consonants such as ch, ng and rh are counted as one letter in Welsh, and therefore one consonant.
The other letters in the Welsh alphabet are vowels, listed below:
a e i o u w y
See below, all of the mutations with the original letter on the left and the resulting mutated letters on the right:
Original | Mutations
---------+---------------
p | b mh ph
t | d nh th
c | g ngh ch
b | f m
d | dd n
g | [no letter] ng
m | f
ll | l
rh | r
Here, [no letter]
means that the g is removed from the start of the word.
Note that there are some consonants which do not mutate:
ch
dd
f
ff
j
l
n
ng
ph
r
s
th
Vowels may also be found at the start of words but do not mutate:
a
e
i
o
u
w
y
Examples
Input: dydd
Output:
dydd
ddydd
nydd
Input: pobl
Output:
pobl
bobl
mhobl
phobl
Input: gwernymynydd
Output:
gwernymynydd
wernymynydd
ngwernymynydd
Input: ffrindiau
Output:
ffrindiau
Input: enw
Output:
enw
Input: theatr
Output:
theatr
On the request of ArtOfCode ;)
Input: llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch
Output:
llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch
lanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch
Rules
The input will only ever be one word.
There will always be more letters after the leading consonant in your input.
Winning
The shortest code in bytes wins.
5New test case:
llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch
– ArtOfCode – 2016-09-10T08:01:29.067Another test case
theatr
;t
mutates butth
doesn't. – Antti Haapala – 2016-09-10T09:32:01.533Should be 'Golff y Côd' - 'yr' only comes before a vowel, you use 'y' before a consonant. – Gareth – 2016-09-10T12:25:43.437
If anyone's interested in the complicated rules regarding mutation in Welsh, there's an app called 'Ap Treiglo' which gives the rules and lists many of the words which cause mutations in the following word. – Gareth – 2016-09-10T12:38:08.327
@Beta Decay Yeah, for the last 5 years. Rhyl before that, for my sins. – Gareth – 2016-09-10T20:02:50.437
Irish does the same thing phonetically, but writes it quite differently (we prepend the urú, so b becomes mb (pronounced m). We even keep the case on the original initial letter, so in English is i mBéarla. Some writers keep the urú in lower case even when writing in block capitals. – TRiG – 2016-10-26T12:19:24.437