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

[Bug]: Sentence Splitters do not set previous and next sentence #3396

Closed
alanakbik opened this issue Jan 17, 2024 · 1 comment
Closed

[Bug]: Sentence Splitters do not set previous and next sentence #3396

alanakbik opened this issue Jan 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alanakbik
Copy link
Collaborator

Describe the bug

The Sentence object has .previous_sentence() and .next_sentence() methods to point to the previous and next sentence in the same document respectively. However, our sentence splitters currently do not set these fields.

To Reproduce

from flair.splitter import SegtokSentenceSplitter

text = "This is a text. I am happy."

splitter = SegtokSentenceSplitter()

sentences = splitter.split(text)

for sentence in sentences:
    print("--")
    print(sentence)
    print(sentence.previous_sentence())
    print(sentence.next_sentence())

Expected behavior

The printouts for previous and next sentence should be set where appropriate.

Logs and Stack traces

No response

Screenshots

No response

Additional Context

No response

Environment

Versions:

Flair

0.13.1

Pytorch

2.0.0+cu117

Transformers

4.31.0

GPU

False

@alanakbik
Copy link
Collaborator Author

Closed by #3397

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

1 participant