diff options
| author | Leonetienne <leonetienne@hotmail.de> | 2022-03-19 13:29:16 +0100 |
|---|---|---|
| committer | Leonetienne <leonetienne@hotmail.de> | 2022-03-19 13:29:16 +0100 |
| commit | d1b13ba7bbbeb1c21464a322258e2be21c057fa2 (patch) | |
| tree | 08ad293692625b17b33ac554aa476757b81acf9d | |
| parent | 577bc93d6d2fa2645a121c7c454248d8a663a8b6 (diff) | |
Added repwawement ruwe for letta C
| -rw-r--r-- | Src/LibUwu.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Src/LibUwu.h b/Src/LibUwu.h index b1e0cf0..a2b1ea2 100644 --- a/Src/LibUwu.h +++ b/Src/LibUwu.h @@ -137,6 +137,36 @@ static inline std::string MakeUwu(std::string boringString) { } ); + // Replace C with W, but only if succeeded and preceeded by a vowel + boringString = Util::ConditionalReplaceButKeepSigns( + boringString, + "c", + "w", + [](const std::string& original, const std::string& finding, const std::size_t index) { + // Don't replace, if we are on the last char + if (index + finding.length() == original.length()) + return false; + + // Don't replace if we're at index 0 + if (index == 0) + return false; + + const char nextChar = CharTools::MakeLower(original[index + finding.length()]); + const char lastChar = CharTools::MakeLower(original[index - 1]); + + // Don't replace, if the next char is not a vowel + if (!CharTools::IsVowel(nextChar)) + return false; + + // Don't replace if the last char is not a vowel + if (!CharTools::IsVowel(lastChar)) + return false; + + // Else, replace + return true; + } + ); + // Replace L with W, but only if not followed or preceded by another L, and if it's not the first character of a word boringString = Util::ConditionalReplaceButKeepSigns( boringString, @@ -196,7 +226,7 @@ static inline std::string MakeUwu(std::string boringString) { } ); - // Replace random punctuation with uwwwwu cute symbols + // Replace random punctuation with uwwwwu cute symbols <3 // About evewy fifteenth symbol std::stringstream ss; std::mt19937 rng(std::hash<std::string>()(boringString)); // Seed rng based on string |
