-
-
Notifications
You must be signed in to change notification settings - Fork 554
pig-latin: clarify instructions #2447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,46 @@ | ||
# Instructions | ||
|
||
Your task is to translate text from English to Pig Latin using the following rules: | ||
|
||
- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to the end of the word (e.g. "apple" -> "appleay"). | ||
Please note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay"). | ||
- **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"). | ||
Consonant sounds can be made up of multiple consonants, such as the "ch" in "chair" or "st" in "stand" (e.g. "chair" -> "airchay"). | ||
- **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"). | ||
- **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"). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've gotten rid of the "cluster" mention, which was confusing. |
||
Your task is to translate text from English to Pig Latin. | ||
The translation is defined using four rules, which look at the pattern of vowels and consonants at the beginning of a word. | ||
These rules look at each word's use of vowels and consonants: | ||
|
||
- vowels: the letters `a`, `e`, `i`, `o`, and `u` | ||
- consonants: the other 21 letters of the English alphabet | ||
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added this little bit to help non-native English speakers with the terminology. |
||
|
||
## Rule 1 | ||
|
||
If a word begins with a vowel, or starts with `"xr"` or `"yt"`, add an `"ay"` sound to the end of the word. | ||
|
||
For example: | ||
|
||
- `"apple"` -> `"appleay"` (starts with vowel) | ||
- `"xray"` -> `"xrayay"` (starts with `"xr"`) | ||
- `"yttria"` -> `"yttriaay"` (starts with `"yt"`) | ||
|
||
## Rule 2 | ||
|
||
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. | ||
|
||
For example: | ||
|
||
- `"pig"` -> `"igp"` -> `"igpay"` (starts with single consonant) | ||
- `"chair"` -> `"airch"` -> `"airchay"` (starts with multiple consonants) | ||
- `"thrush"` -> `"ushthr"` -> `"ushthray"` (starts with multiple consonants) | ||
|
||
## Rule 3 | ||
|
||
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. | ||
|
||
For example: | ||
|
||
- `"quick"` -> `"ickqu"` -> `"ay"` (starts with `"qu"`, no preceding consonants) | ||
- `"square"` -> `"aresqu"` -> `"aresquay"` (starts with one consonant followed by `"qu`") | ||
|
||
## Rule 4 | ||
|
||
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. | ||
|
||
Some examples: | ||
|
||
- `"my"` -> `"ym"` -> `"ymay"` (starts with single consonant followed by `"y"`) | ||
- `"rhythm"` -> `"ythmrh"` -> `"ythmrhay"` (starts with multiple consonants followed by `"y"`) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gotten rid of the "sound" references, which made it confusing to me.