-
Notifications
You must be signed in to change notification settings - Fork 163
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 rounding optional #166
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @LKirst. Thank you for this! I'm happy to accept this as a work around for rounding. The build is currently failing though, see review comments.
Hi @alxwrd, Thank you for your feedback. I've implemented the changes as requested. |
Excellent, thank you! I've just pushed a couple of tests as I was playing around with it. The usage of import textstat
textstat.textstat.round_outputs = False felt a bit awkward. But, as we expose all the methods of a default textstat instance in the textstat module namespace, >>> textstat.char_count.__self__ is textstat.textstat.char_count.__self__
True I've changed the usage to So the usage for the default textstat instance is: import textstat
textstat.set_rounding(False) of course you could still create a separate instance: import textstat
from textstat.textstat import textstatistics
my_textstat = textstatistics()
my_textstat.set_rounding(False)
my_not_rounded_index = my_textstat.spache_readability(long_test)
assert my_not_rounded_index == 5.2500456989247315
default_rounded_index = textstat.spache_readability(long_test)
assert default_rounded_index == 5.25 |
Make rounding of outputs optional by allowing the user to change the boolean attribute
round_outputs
of an instance of thetextstatistics
class.