langtest.transform.robustness.ConvertAccent#
- class ConvertAccent#
Bases:
BaseRobustness
- __init__()#
Methods
__init__
()async_run
(sample_list, model, **kwargs)Creates a task to run the robustness measure.
run
(sample_list, model, **kwargs)Abstract method that implements the robustness measure.
transform
(sample_list[, accent_map])Converts input sentences using a conversion dictionary :param sample_list: List of sentences to process.
Attributes
alias_name
- async classmethod async_run(sample_list: List[Sample], model: ModelFactory, **kwargs)#
Creates a task to run the robustness measure.
- Parameters:
sample_list (List[Sample]) – The input data to be transformed.
model (ModelFactory) – The model to be used for evaluation.
**kwargs – Additional arguments to be passed to the robustness measure.
- Returns:
The task that runs the robustness measure.
- Return type:
asyncio.Task
- abstract async static run(sample_list: List[Sample], model: ModelFactory, **kwargs) List[Sample] #
Abstract method that implements the robustness measure.
- Parameters:
sample_list (List[Sample]) – The input data to be transformed.
model (ModelFactory) – The model to be used for evaluation.
**kwargs – Additional arguments to be passed to the robustness measure.
- Returns:
The transformed data based on the implemented robustness measure.
- Return type:
List[Sample]
- static transform(sample_list: List[Sample], accent_map: Dict[str, str] | None = None) List[Sample] #
Converts input sentences using a conversion dictionary :param sample_list: List of sentences to process. :param accent_map: Dictionary with conversion terms.
- Returns:
List of sentences that perturbed with accent conversion.