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 // Collapse newlines and spaces into single space
text = text.replace(/\s+/g, ' '); text = text.replace(/\s+/g, ' ').trim();
console.log(`TTS: ${text}`) console.log(`TTS: ${text}`)
const char = currentTtsJob.name const char = currentTtsJob.name

View File

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