From 61734bc22de6ac7a050ba5ef1154f4f312be31a3 Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Sun, 2 Nov 2025 00:54:56 +0100
Subject: [PATCH] fix neutralization names
---
.../mainServiceNeutralization.py | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/modules/services/serviceNeutralization/mainServiceNeutralization.py b/modules/services/serviceNeutralization/mainServiceNeutralization.py
index db130242..29644903 100644
--- a/modules/services/serviceNeutralization/mainServiceNeutralization.py
+++ b/modules/services/serviceNeutralization/mainServiceNeutralization.py
@@ -142,12 +142,38 @@ class NeutralizationService:
return False
return self.interfaceDbApp.deleteNeutralizationAttributes(fileId)
+ def _reloadNamesFromConfig(self) -> None:
+ """Reload names from config and update processors"""
+ try:
+ config = self.getConfig()
+ if not config:
+ return
+
+ # Parse namesToParse string into list
+ names_list = []
+ if config.namesToParse:
+ names_list = [name.strip() for name in config.namesToParse.split('\n') if name.strip()]
+
+ # Update internal list
+ self.NamesToParse = names_list
+
+ # Recreate processors with updated names
+ self.textProcessor = TextProcessor(names_list)
+ self.listProcessor = ListProcessor(names_list)
+
+ logger.debug(f"Reloaded {len(names_list)} names from config")
+ except Exception as e:
+ logger.error(f"Error reloading names from config: {str(e)}")
+ # Continue with existing names if reload fails
# Helper functions
def _neutralizeText(self, text: str, textType: str = None) -> Dict[str, Any]:
"""Process text and return unified dict for API consumption."""
try:
+ # Reload names from config before processing to ensure we have the latest names
+ self._reloadNamesFromConfig()
+
# Auto-detect content type if not provided
if textType is None:
textType = self.commonUtils.detectContentType(text)