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

Should make percent_difference accept integers instead of TextSample object #1

Open
jmcrey opened this issue May 20, 2019 · 0 comments

Comments

@jmcrey
Copy link

jmcrey commented May 20, 2019

def percent_difference(sample1, sample2): 
    v1 = sample1.average_sentence_length
    v2 = sample2.average_sentence_length

    #Calculate and return according to the formula (v1 - v2) / ((v1 + v2)/2)
    return abs(v1 - v2) / ((v1 + v2)/2)

Really nice job with this function! The only thing I might change about this function is that it should accept an integer instead of the TextSample object so that the function can be used for non-TextSample objects. By changing this funciton to accept an integer it can be used for other purposes except for this project, thus making it more flexible. Of course, this approach is perfect for the purposes of this project, so it is perfectly acceptable. Just a suggestion.

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

No branches or pull requests

1 participant