-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve coverage and clean entry points
- Loading branch information
Showing
12 changed files
with
206 additions
and
376 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
47 changes: 47 additions & 0 deletions
47
edsnlp/pipelines/core/normalizer/remove_lowercase/factory.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from spacy.language import Language | ||
from spacy.tokens import Doc | ||
|
||
from edsnlp.utils.deprecation import deprecated_factory | ||
|
||
|
||
def remove_lowercase(doc: Doc): | ||
""" | ||
Add case on the `NORM` custom attribute. Should always be applied first. | ||
Parameters | ||
---------- | ||
doc : Doc | ||
The spaCy `Doc` object. | ||
Returns | ||
------- | ||
Doc | ||
The document, with case put back in `NORM`. | ||
""" | ||
|
||
for token in doc: | ||
token.norm_ = token.text | ||
|
||
return doc | ||
|
||
|
||
@deprecated_factory("remove-lowercase", "eds.remove_lowercase", assigns=["token.norm"]) | ||
@deprecated_factory( | ||
"eds.remove-lowercase", "eds.remove_lowercase", assigns=["token.norm"] | ||
) | ||
@Language.factory("eds.remove_lowercase", assigns=["token.norm"]) | ||
def create_component( | ||
nlp: Language, | ||
name: str, | ||
): | ||
""" | ||
Add case on the `NORM` custom attribute. Should always be applied first. | ||
Parameters | ||
---------- | ||
nlp : Language | ||
The pipeline object. | ||
name : str | ||
The name of the component. | ||
""" | ||
return remove_lowercase # pragma: no cover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.