refactor(vocab): unify text normalization across VocabService and VocabPracticeDialog
All checks were successful
Deploy to production / deploy (push) Successful in 3m3s

- Enhanced text normalization methods in VocabService and VocabPracticeDialog to include normalization and improved regex for punctuation and symbols, ensuring consistent text handling.
- This update streamlines the normalization process, contributing to better user input processing and overall application reliability.
This commit is contained in:
Torsten Schulz (local)
2026-04-01 15:24:22 +02:00
parent d38231b52c
commit d39cea2c01
3 changed files with 14 additions and 6 deletions

View File

@@ -342,12 +342,14 @@ export default class VocabService {
}
_normalizeTextAnswer(text) {
return String(text || '')
const normalized = String(text || '')
.trim()
.toLowerCase()
.replace(/[\p{P}]+/gu, ' ')
.normalize('NFKC')
.replace(/[\p{P}\p{S}]+/gu, ' ')
.replace(/\s+/g, ' ')
.trim();
return normalized.replace(/\s+/g, '');
}
_parseExercisePayload(value) {