-
Notifications
You must be signed in to change notification settings - Fork 84
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
β¨ π« sent char_span
through with spaCy & regex & β»οΈ Refactoring for more languages support
#63
Merged
Conversation
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
fixes 62
Use GitHub actions for CI
Use GitHub actions for CI
nipunsadvilkar
changed the title
β¨ π« sent char_span through with spaCy & regex
β¨ π« sent May 29, 2020
char_span
through with spaCy & regex
Add spacy dependency
Major refactor & updated tests
Codecov Report
@@ Coverage Diff @@
## master #63 +/- ##
=========================================
Coverage ? 97.45%
=========================================
Files ? 20
Lines ? 748
Branches ? 0
=========================================
Hits ? 729
Misses ? 19
Partials ? 0
Continue to review full report at Codecov.
|
release candidate
nipunsadvilkar
changed the title
β¨ π« sent
β¨ π« sent Jun 9, 2020
char_span
through with spaCy & regexchar_span
through with spaCy & regex & β»οΈ Refactoring for more languages support
This was referenced Jun 9, 2020
Closed
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
πOld Approach
TLDR - Sentences(string) were right β Sentence char spans were wrong β
Earlier
pysbd v0.2.3
depended on creatingDoc
object through regex search -SENTENCE_BOUNDARY_REGEX
- on a preprocessed text. The preprocessing is an essential part of pysbd rules which adds Unicode symbols to decide when to/not to break the sentence. Due to the addition of Unicode symbols, char_spans found by regex were not proper in contrast to original text. Another caveat was - spaCy doesn't provideDoc
object if there is leading/trailing whitespace and returnsNone
which used to lead to wrong char spans.β¨New Approach
Use
Token.is_sent_start
attribute over getting anDoc
object to get correct char_spansRely on pysbd to give proper sentences (strings) out of the original text -> use regex to find those sentence within original text & keep start char indices of sentence matches > iterate over each
Token
ofDoc
object and setToken.is_sent_start
True (if insent_start_token_idx
) elseFalse
.In preliminary testing, new approach seems to be resolving issues raised by developers.
bleach
- Bump bleach from 3.1.0 to 3.1.4Β #62CHANGELOG
char_span
through with spaCy & regex approach - β¨ π« sentchar_span
through with spaCy & regex & β»οΈ Refactoring for more languages supportΒ #63NUMBERED_REFERENCE_REGEX
for zero or one time - Long number stalls process.Β #58