[tts] Fix invalid formatting

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-11-20 12:06:00 +00:00
committed by Konstantin Pastbin
parent 762797684e
commit 70a7107499

View File

@@ -213,15 +213,18 @@ std::string GetTtsText::GetTurnNotification(Notification const & notification) c
}
}
std::string ttsOut = distDirOntoStreetStr + distStr + // in 100 feet
dirStr + // turn right / take exit
ontoStr + // onto / null
streetOut + // Main Street / 543:: M4: Queens Parkway, London
dirVerb; // (optional "turn right" verb)
char ttsOut[1024];
std::snprintf(ttsOut, std::size(ttsOut), distDirOntoStreetStr.c_str(),
distStr.c_str(), // in 100 feet
dirStr.c_str(), // turn right / take exit
ontoStr.c_str(), // onto / null
streetOut.c_str(), // Main Street / 543:: M4: Queens Parkway, London
dirVerb.c_str() // (optional "turn right" verb)
);
// remove floating punctuation
static boost::regex const rP(" [,\\.:;]+ ");
std::string cleanOut = boost::regex_replace(ttsOut, rP, " ");
std::string cleanOut = boost::regex_replace(std::string(ttsOut), rP, " ");
// remove repetitious spaces or colons
static boost::regex const rS("[ :]{2,99}");
cleanOut = boost::regex_replace(cleanOut, rS, " ");