Skip to content
Snippets Groups Projects
Commit 817a6c9f authored by Bartosz Walkowiak's avatar Bartosz Walkowiak
Browse files

Update main.py

parent 046c75ef
1 merge request!10Anonimizer v2
Pipeline #7904 passed with stage
in 46 seconds
"""Implementation of anonymizer service.""" """Implementation of anonymizer service."""
import nlp_ws import nlp_ws
from src.worker_old import Worker from src.worker import Worker
import logging import logging
import nlp_ws import nlp_ws
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)
class AnonymizerWorker(nlp_ws.NLPWorker): class AnonymizerWorker(nlp_ws.NLPWorker):
"""Class implementing TextFixerWorker worker.""" """Class implementing TextFixerWorker worker."""
@classmethod @classmethod
def static_init(cls, config): def static_init(cls, config):
"""Initialize process.""" """Initialize process."""
cls._configuration = config.get("tool").get("configuration", "ccl") cls._configuration = config.get("tool").get("configuration", "ccl")
cls._default_language = config.get("tool").get("default_language", "pl") cls._default_language = config.get("tool").get("default_language", "pl")
cls._default_replacer = config.get("tool").get("default_replacer", "tag") cls._default_replacer = config.get("tool").get("default_replacer", "tag")
_log.info( _log.info(
"AnonymizerWorker initialized with configuration: %s, default language: %s, default replacer: %s", "AnonymizerWorker initialized with configuration: %s, default language: %s, default replacer: %s",
cls._configuration, cls._configuration,
cls._default_language, cls._default_language,
cls._default_replacer, cls._default_replacer,
) )
def __init__(self): def __init__(self):
self._worker = Worker( self._worker = Worker(
configuration=self._configuration, configuration=self._configuration,
default_language=self._default_language, default_language=self._default_language,
default_replacer=self._default_replacer, default_replacer=self._default_replacer,
) )
def process(self, input_file, task_options, output_file): def process(self, input_file, task_options, output_file):
self._worker.process(input_file, task_options, output_file) self._worker.process(input_file, task_options, output_file)
if __name__ == "__main__": if __name__ == "__main__":
nlp_ws.NLPService.main(AnonymizerWorker, pause_at_exit=False) nlp_ws.NLPService.main(AnonymizerWorker, pause_at_exit=False)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment