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

Fix concatenating sentence parts separated with newlines #506

Closed
AndyTheFactory opened this issue Oct 24, 2023 · 1 comment
Closed

Fix concatenating sentence parts separated with newlines #506

AndyTheFactory opened this issue Oct 24, 2023 · 1 comment
Labels
PR-verify Has a PR, must be checked undecided yet
Milestone

Comments

@AndyTheFactory
Copy link
Owner

Issue by dhgelling
Fri Feb 12 13:22:28 2021
Originally opened as codelucas/newspaper#873


The text content of newspapers seems to be returned as paragraphs separated by two newlines. When doing nlp on this, the tokenizer sometimes thinks a sentence spans across two paragraphs, returning a sentence looking like 'first sentence\n\nsecond sentence', which means this part of the code would concatenate the words sentence and second, returning 'first sentencesecond sentence'. This change is meant to fix that, by replacing any run of multiple spaces or newlines by one space.

Another solution would be to first split on double newlines and processing the content of that separately before concatenating again, but this seemed like it would change the least


dhgelling included the following code: https://github.com/codelucas/newspaper/pull/873/commits

@AndyTheFactory AndyTheFactory added undecided yet PR-verify Has a PR, must be checked labels Oct 30, 2023
@AndyTheFactory AndyTheFactory added this to the Release 0.9.1 milestone Oct 30, 2023
@AndyTheFactory
Copy link
Owner Author

changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-verify Has a PR, must be checked undecided yet
Projects
None yet
Development

No branches or pull requests

1 participant