Skip to content

Commit

Permalink
fix: updated wrong type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethEnevoldsen committed Dec 9, 2023
1 parent bba7a11 commit 7c08328
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/augmenty/span/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def create_ent_augmenter_v1(
i.e. ["Kenneth", "Enevoldsen"], 2) a string of the desired entity i.e. "Kenneth Enevoldsen", this
will be split using the tokenizer of the nlp pipeline, or 3) Span object with the desired entity, here all information will be passed
on except for the dependency tree.
replace_consistency: Should an entity always be replaced with the same entity?
replace_consistency: Should an entity always be replaced with the same entity?
resolve_dependencies: Attempts to resolve the dependency tree
by setting head of the original entitity aa the head of the
first token in the new entity. The remainder is the passed as
Expand Down
3 changes: 2 additions & 1 deletion src/augmenty/token/insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ def __insert(
if context_window:
span = doc[
max(0, t.i - context_window) : min( # type: ignore
len(doc), t.i + context_window # type: ignore
len(doc),
t.i + context_window, # type: ignore
)
]
elif doc.has_annotation("SENT_START"):
Expand Down
4 changes: 2 additions & 2 deletions src/augmenty/token/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def create_token__dict_replace_augmenter_v1(
Args:
level: Probability to replace token given that it is in synonym dictionary.
replace: A dictionary of words and a list of their replacement (e.g. synonyms) or a dictionary denoting replacement based on pos tag.
ignore_casing: When doing the lookup should the model ignore casing?
ignore_casing: When doing the lookup should the model ignore casing?
getter: A getter function to extract the POS-tag.
keep_titlecase: Should the model keep the titlecase of the replaced word.
keep_titlecase: Should the model keep the titlecase of the replaced word.
Returns:
The augmenter.
Expand Down
6 changes: 3 additions & 3 deletions tests/test_all_augmenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ def is_pronoun(token: Token) -> bool:
),
],
)
def test_augmenters(aug: Callable, args: dict, examples, nlp: Language, level: float): # noqa # type: ignore
def test_augmenters(aug: str, args: dict, examples, nlp: Language, level: float): # noqa # type: ignore
args["level"] = level
aug = augmenty.load(aug, **args)
augmented_examples = [e for ex in examples for e in aug(nlp=nlp, example=ex)]
augmenter = augmenty.load(aug, **args)
augmented_examples = [e for ex in examples for e in augmenter(nlp=nlp, example=ex)]


def test_check_untested():
Expand Down

0 comments on commit 7c08328

Please sign in to comment.