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

Sentencizer cut codes in different sentences while it's the same token #178

Closed
etienneguevel opened this issue Jan 11, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@etienneguevel
Copy link
Contributor

etienneguevel commented Jan 11, 2023

Description

For the moment the sentencizer makes a new sentence when there is a "." character followed by a capitalized letter.
This can be problematic for some codes or accronyms, as they can be constructed with those patterns (example : "V.I.H",), and will be divided in different sentences.

The ADICAP codes analysed by the eds.adicap pipeline can be found in text in the form : "code ADICAP : B.H.HP.A7A0", and the eds.contextual-matcher used behind will not capture the code.

A solution would be to create a new sentence if there is a . followed by a space/new line/other separation and a capitalized letter.

How to reproduce the bug

import spacy

nlp = spacy.blank("eds")
nlp.add_pipe("eds.normalizer")
nlp.add_pipe("eds.sentences")

code = "B.H.HP.A7A0"

for sent in nlp(code).sents:
    print(sent.text)

B.
H.
HP.
A7A0

Your Environment

  • Operating System: Ubuntu 22.04.1 LTS
  • Python Version Used: 3.10.6
  • spaCy Version Used: 3.4.1
  • EDS-NLP Version Used: 0.7.4
  • Environment Information:
@etienneguevel etienneguevel changed the title Feature request: Modification of the way the sentencizer cuts the document Sentencizer cut codes in different sentences while it's the same token Jan 11, 2023
@etienneguevel etienneguevel added the bug Something isn't working label Jan 12, 2023
@percevalw
Copy link
Member

Thanks for this issue ! this has been solved by changing the tokenization rules to distinguish "real" end-of-sentence periods from abbreviation periods in #192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants