mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
18 lines
459 B
Python
18 lines
459 B
Python
|
from abc import ABC, abstractmethod
|
||
|
|
||
|
|
||
|
class AnonymizerBase(ABC):
|
||
|
"""
|
||
|
Base abstract class for anonymizers.
|
||
|
It is public and non-virtual because it allows
|
||
|
wrapping the behavior for all methods in a base class.
|
||
|
"""
|
||
|
|
||
|
def anonymize(self, text: str) -> str:
|
||
|
"""Anonymize text"""
|
||
|
return self._anonymize(text)
|
||
|
|
||
|
@abstractmethod
|
||
|
def _anonymize(self, text: str) -> str:
|
||
|
"""Abstract method to anonymize text"""
|