Skip to content

Commit 93dae1e

Browse files
ErikSchierboomglennj
authored andcommitted
Sync the pig-latin exercise's docs with the latest data. (exercism#352)
1 parent 91242b3 commit 93dae1e

File tree

1 file changed

+44
-8
lines changed

1 file changed

+44
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
11
# Instructions
22

3-
Your task is to translate text from English to Pig Latin using the following rules:
4-
5-
- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to the end of the word (e.g. "apple" -> "appleay").
6-
Please note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay").
7-
- **Rule 2**: If a word begins with a consonant sound, move it to the end of the word and then add an "ay" sound to the end of the word (e.g. "pig" -> "igpay").
8-
Consonant sounds can be made up of multiple consonants, such as the "ch" in "chair" or "st" in "stand" (e.g. "chair" -> "airchay").
9-
- **Rule 3**: If a word starts with a consonant sound followed by "qu", move them to the end of the word, and then add an "ay" sound to the end of the word (e.g. "square" -> "aresquay").
10-
- **Rule 4**: If a word contains a "y" after a consonant cluster or as the second letter in a two letter word it makes a vowel sound (e.g. "rhythm" -> "ythmrhay", "my" -> "ymay").
3+
Your task is to translate text from English to Pig Latin.
4+
The translation is defined using four rules, which look at the pattern of vowels and consonants at the beginning of a word.
5+
These rules look at each word's use of vowels and consonants:
6+
7+
- vowels: the letters `a`, `e`, `i`, `o`, and `u`
8+
- consonants: the other 21 letters of the English alphabet
9+
10+
## Rule 1
11+
12+
If a word begins with a vowel, or starts with `"xr"` or `"yt"`, add an `"ay"` sound to the end of the word.
13+
14+
For example:
15+
16+
- `"apple"` -> `"appleay"` (starts with vowel)
17+
- `"xray"` -> `"xrayay"` (starts with `"xr"`)
18+
- `"yttria"` -> `"yttriaay"` (starts with `"yt"`)
19+
20+
## Rule 2
21+
22+
If a word begins with a one or more consonants, first move those consonants to the end of the word and then add an `"ay"` sound to the end of the word.
23+
24+
For example:
25+
26+
- `"pig"` -> `"igp"` -> `"igpay"` (starts with single consonant)
27+
- `"chair"` -> `"airch"` -> `"airchay"` (starts with multiple consonants)
28+
- `"thrush"` -> `"ushthr"` -> `"ushthray"` (starts with multiple consonants)
29+
30+
## Rule 3
31+
32+
If a word starts with zero or more consonants followed by `"qu"`, first move those consonants (if any) and the `"qu"` part to the end of the word, and then add an `"ay"` sound to the end of the word.
33+
34+
For example:
35+
36+
- `"quick"` -> `"ickqu"` -> `"ay"` (starts with `"qu"`, no preceding consonants)
37+
- `"square"` -> `"aresqu"` -> `"aresquay"` (starts with one consonant followed by `"qu`")
38+
39+
## Rule 4
40+
41+
If a word starts with one or more consonants followed by `"y"`, first move the consonants preceding the `"y"`to the end of the word, and then add an `"ay"` sound to the end of the word.
42+
43+
Some examples:
44+
45+
- `"my"` -> `"ym"` -> `"ymay"` (starts with single consonant followed by `"y"`)
46+
- `"rhythm"` -> `"ythmrh"` -> `"ythmrhay"` (starts with multiple consonants followed by `"y"`)

0 commit comments

Comments
 (0)