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)