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

Make the reading ease score cope better with free-form poetry #656

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

robinwhittleton
Copy link
Member

When processing the text to calculate the reading ease score, we can first preprocess it to allow for verse that doesn’t end with punctuation. If we add a full stop at the end of verses just for the reading ease algorithm then we get more normal scores, and it shouldn’t affect other productions in a meaningful way.

  1. Mina Loy’s Poetry goes from -128.58 to 42.45
  2. William Carlos William’s Poetry goes from 79.5 to 79.6
  3. Laurence Sterne’s Tristram Shandy goes from 51.35 to 51.55
  4. Every other repo I’ve tried has no change.

@acabal
Copy link
Member

acabal commented Mar 1, 2024

Glad to see you figured it out. I suggest some minor tweaks to the regex:

  • Replace \t with \s so it's a more generic match in case the toolset is used on non-SE books
  • Use \1 and \2 instead of \<g>1, to follow the style in the rest of the code
  • We create a capture group for (\t) but never use it (there is no \3). I think this can simply be non-capturing.

When processing the text to calculate the reading ease score, we can first preprocess it to allow for verse that doesn’t end with punctuation. If we add a full stop at the end of verses just for the reading ease algorithm then we get more normal scores, and it shouldn’t affect other productions in a meaningful way.

1. Mina Loy’s Poetry goes from -128.58 to 42.45
2. William Carlos William’s Poetry goes from 79.5 to 79.6
3. Laurence Sterne’s Tristram Shandy goes from 51.35 to 51.55
4. Every other repo I’ve tried has no change.
@robinwhittleton robinwhittleton force-pushed the flesch-for-freeform-verse branch from 571aaa4 to 8f75759 Compare March 1, 2024 18:01
@robinwhittleton
Copy link
Member Author

All good points that I should have done from the start, but that’s what review is for. Done and pushed.

@acabal acabal merged commit 9c5b73d into master Mar 1, 2024
2 checks passed
@acabal
Copy link
Member

acabal commented Mar 1, 2024

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants