refactor(vocab): unify text normalization across VocabService and VocabPracticeDialog
All checks were successful
Deploy to production / deploy (push) Successful in 3m3s
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user