Anslatortray
|
Namespace containing functions to translate from English to Pig Latin. More...
Namespaces | |
Characters | |
Arrays of diffrent characters (internal use) | |
Functions | |
std::string | smartWordToPig (const std::string &englishWord) |
Translates a single complex English word to Pig Latin. (more robust) More... | |
std::string | translate (const std::string &englishText) |
Uses smartWordToPig and changeWords to perform translation from English to Pig Latin on every word it is given. More... | |
std::string | wordToPig (const std::string &englishWord) |
Translates a single English word to Pig Latin. More... | |
std::string | wordsToPig (const std::string &englishWords) |
Uses wordToPig and changeWords to perform dumb translation from English to Pig Latin on every word it is given. More... | |
std::string | attemptWordToEnglish (const std::string &pig, std::uint64_t numBeginningConosoants=1) |
Tries to translate a word in Pig Latin back to english. More... | |
std::string | changeWords (const std::string &words, std::string wordChanger(const std::string &word)) |
Helper function to perform an operation on all whitespace-seperated words (tokens) given to it. More... | |
Variables | |
constexpr char | VOWEL_START_STYLE [] = {"way"} |
Ending to use if word to translate starts with a vowel. More... | |
Namespace containing functions to translate from English to Pig Latin.
|
inline |
Tries to translate a word in Pig Latin back to english.
This is hard to do because diffrent English words can be the same in Pig Latin.
pig | Word in Pig Latin |
numBeginningConosoants | The number of conosonants before the first vowel in the original word. Default 1 (most common) |
|
inline |
Helper function to perform an operation on all whitespace-seperated words (tokens) given to it.
See Characters::WHITESPACE for the types
words | Words (tokens) seperated by whitespace |
wordChanger | Function taking a const std::string & as a single parameter and returning a std::string |
|
inline |
Translates a single complex English word to Pig Latin. (more robust)
Unlike wordToPig, this function also handles punctuation (not seperated by whitespace), singular possesion ('s) and capatilizes the first letter if the original english word was capatilized.
Imperfect results with plural words (ending in "s") and words with mutiple possesion (ending in "s'")
englishWord | An English word to translate |
|
inline |
Uses smartWordToPig and changeWords to perform translation from English to Pig Latin on every word it is given.
Replaces all whitespace with a regular space.
englishText | The original English text |
|
inline |
Uses wordToPig and changeWords to perform dumb translation from English to Pig Latin on every word it is given.
Replaces all whitespace with a regular space.
englishWords | The original English text |
|
inline |
Translates a single English word to Pig Latin.
Moves all constanants until the first vowel to the end of the word and adds "ay". Alternativly, if the word starts with a vowel, "way" is added to the end.
englishWord | An English word to translate |
constexpr char anslatortray::VOWEL_START_STYLE[] = {"way"} |
Ending to use if word to translate starts with a vowel.