Skip to content

Commit

Permalink
parameter: number_of_lines -> max_lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravarthik27 committed Sep 14, 2024
1 parent f274765 commit 0414f71
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions langtest/transform/robustness.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ def transform(
sample_list: List[Sample],
prob: Optional[float] = 1.0,
count: int = 1,
number_of_lines: int = 3,
max_lines: int = 3,
) -> List[Sample]:
"""Transforms the given sample list by adding new lines to the input text.
Expand All @@ -1957,6 +1957,7 @@ def transform(
prob (Optional[float]): The probability controlling the proportion of samples to be perturbed.
Defaults to 0.2.
count: Number of variations to create.
max_lines: Maximum number of lines to add.
Returns:
List[Sample]: The transformed list of samples with new lines added.
Expand Down Expand Up @@ -2002,7 +2003,7 @@ def add_new_lines(text: str) -> Tuple[str, List[Transformation]]:
perturbed_word = token["word"]

if i in transformed_indices:
perturbed_word += "\n" * max(1, random.randint(1, number_of_lines))
perturbed_word += "\n" * max(1, random.randint(1, max_lines))
transformations.append(
Transformation(
original_span=Span(
Expand Down

0 comments on commit 0414f71

Please sign in to comment.