From 50ca78ee9021a09122e08810646dda71a620f15a Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Sat, 12 Feb 2022 03:58:39 +0100 Subject: Impwuvd readabiwity for words containying "one" --- main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index fe48cd4..9bf8b2f 100644 --- a/main.cpp +++ b/main.cpp @@ -217,7 +217,7 @@ std::string MakeUwu(std::string boringString) { boringString = ReplaceButKeepSigns(boringString, "dear", "hiiiiiii"); boringString = ReplaceButKeepSigns(boringString, "hi", "hiiiiiii"); - // Replace N with Ny, but only if succeeded by a vowel + // Replace N with Ny, but only if succeeded by a vowel, and not preceded by an o: "one" has such a niche pronunciation. boringString = ReplaceButKeepSigns( boringString, "n", @@ -227,8 +227,12 @@ std::string MakeUwu(std::string boringString) { if (index + found.length() == boringString.length() - 1) return false; - // Only replace if the next char is a vowel const char nextChar = MakeLower(boringString[index + found.length()]); + const char lastChar = MakeLower(boringString[index - 1]); + + // Don't replace if the last char is an 'o' + if (lastChar == 'o') + return false; // Is this a vowel? if (IsVowel(nextChar)) @@ -253,7 +257,6 @@ std::string MakeUwu(std::string boringString) { if (index == 0) return false; - // Only replace if the next char is a vowel const char nextChar = MakeLower(boringString[index + found.length()]); const char lastChar = MakeLower(boringString[index - 1]); -- cgit v1.2.3