Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalizer pipeline inefficient #330

Open
OlivierHassanaly opened this issue Nov 5, 2024 · 1 comment
Open

Normalizer pipeline inefficient #330

OlivierHassanaly opened this issue Nov 5, 2024 · 1 comment

Comments

@OlivierHassanaly
Copy link

It seems that the eds.normalizer pipe does not act

i am using edsnlp version 0.13.1

How to reproduce the bug

config = dict(
lowercase=True,
accents=True,
quotes=False,
spaces=False,
pollution=True,
)

nlp = edsnlp.blank("eds")
nlp.add_pipe("eds.normalizer", config=config)

text = "Pneumopathie à NBNbWbWbNbWbNBNbNbWbW `coronavirus'"

doc = nlp(text)

print(doc.text)

I get unchanged text as a result

@percevalw
Copy link
Member

Hi @OlivierHassanaly !

The doc.text always contain the original text of the document, to use the results of the eds.normalizer pipeline, you should use edsnlp.utils.doc_to_text.get_text as shown here http://aphp.github.io/edsnlp/latest/pipes/core/normalizer/#usage

import edsnlp
from edsnlp.utils.doc_to_text import get_text

config = dict(
    lowercase=True,
    accents=True,
    quotes=False,
    spaces=False,
    pollution=True,
)

nlp = edsnlp.blank("eds")
nlp.add_pipe("eds.normalizer", config=config)

text = "Pneumopathie à NBNbWbWbNbWbNBNbNbWbW `coronavirus'"

doc = nlp(text)

print(get_text(doc, attr='TEXT', ignore_excluded=True))
# Out: Pneumopathie à `coronavirus'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants