Improve XTTS text processing

This commit is contained in:
Cohee 2023-11-28 16:56:50 +02:00
parent 82b7238b39
commit f809d80ba2
2 changed files with 6 additions and 4 deletions

View File

@ -508,7 +508,7 @@ async function processTtsQueue() {
}
// Collapse newlines and spaces into single space
text = text.replace(/\s+/g, ' ');
text = text.replace(/\s+/g, ' ').trim();
console.log(`TTS: ${text}`)
const char = currentTtsJob.name

View File

@ -20,10 +20,12 @@ class XTTSTtsProvider {
*/
processText(text) {
// Replace fancy ellipsis with "..."
text = text.replace(/…/g, '...')
text = text.replace(/…/g, '...');
// Remove quotes
text = text.replace(/["“”‘’]/g, '');
// Replace multiple "." with single "."
text = text.replace(/\.+/g, '.')
return text
text = text.replace(/\.+/g, '.');
return text;
}
languageLabels = {