Parser.getSentencePositionScore() off-by-one #10
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.
In
parser.py:When Summarizer scores sentences (
Summarizer.computeScore()) it iterates through the list and passes the index as its argument. Notice what happens when you unroll that loop, though:Instinct tells me that a (next-to-)zero score for the introductory and concluding sentences is wrong. Adding to my suspicions, sum of all cases in the referenced paper are
0 < normalized <= 1.0.To me this looks like an off-by-one bug. Nine of the ten sentences above are caught one case too early and the first falls to default. That shouldn't even happen with valid arguments!
If I'm opinionated about this as an issue, respectable people can differ about where to fix it. One could make a case for
Summarizer.computeScore()butParser.getSentencePositionScore()is already parameterized for index (zero-based, presumably) so fixing it there has the smallest impact.