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

Implement Kincaid-Fleisch test on comments #16

Open
mgajda opened this issue Sep 12, 2019 · 13 comments
Open

Implement Kincaid-Fleisch test on comments #16

mgajda opened this issue Sep 12, 2019 · 13 comments
Labels
enhancement hacktoberfest Hacktoberfest.digitalocean.com help wanted

Comments

@mgajda
Copy link
Collaborator

mgajda commented Sep 12, 2019

Kincaid-Fleisch readability test on comments is easy to compute metric that allows to estimate how hard it is to read the comment.

@GildedHonour
Copy link

Since the comments are independent from each other, each peace of a comment accross all the code files should be extracted and tested manually for readability. Correct?

@mgajda
Copy link
Collaborator Author

mgajda commented Sep 18, 2019

Actually homplexity has a different method:

  • first we gather all comments (or metrics) per unit of code (function or module)
  • then compute statistics for entire unit

@mgajda
Copy link
Collaborator Author

mgajda commented Sep 19, 2019

I corrected this on Gitter: we should first assign comments to individual functions or modules, and then extract readability statistics per code unit (module, function, or other top level declaration ).

@GildedHonour
Copy link

Okay.

I'm getting familiar with the code. It's unclear still how it works -- the algorithms for different metircs, parsing...

@workshub
Copy link

workshub bot commented Oct 4, 2019

This issue is now published on WorksHub. If you would like to work on this issue you can
start work on the WorksHub Issue Details page.

@mgajda mgajda added the hacktoberfest Hacktoberfest.digitalocean.com label Oct 7, 2019
@workshub
Copy link

workshub bot commented Oct 21, 2019

@willnwhite started working on this issue via WorksHub.

@ghost
Copy link

ghost commented Oct 21, 2019

How accurate must the Kincaid-Fleisch test be? The test depends on the number of syllables, and I think the only way to accurately get the number of syllables in a word is by using a list of all words and how many syllables each one has... no algorithm is more accurate than that. However, this would add to program size/network requests compared to using an algorithm.

@mgajda
Copy link
Collaborator Author

mgajda commented Jan 25, 2020

I bet that syllabification can be super-simple, with only checking consecutive stretches of vowels and consonants. This is statistics, small errors should not change much.

So you can have:

isVowel = (`elem` "aeoiu")
countSyllables = length . filter (not . null) . break isVowel

Same for sentences:

isPunct = (`elem` ",:.!?")
countSentences = length . filter (not . null) . break isPunct

@mgajda
Copy link
Collaborator Author

mgajda commented Jan 29, 2020

Please note that the code will be probably too short to justify Kincaid-Fleisch package on its own.
Unless you plan to maintain it for the other project.

@ghost
Copy link

ghost commented Jan 30, 2020

The test is very sensitive to the syllable count. I ran your algorithm on a comment from this project and the score was -66, versus the real score of 30. Could that still be useful, e.g. for relative scores, or not?

@mgajda
Copy link
Collaborator Author

mgajda commented Feb 2, 2020

Did you split words before running syllable count?

@ghost
Copy link

ghost commented Feb 4, 2020

Yes.

@mgajda
Copy link
Collaborator Author

mgajda commented Feb 5, 2020

Tell me your branch, and I will try to help you find the bug.
https://gitter.im/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement hacktoberfest Hacktoberfest.digitalocean.com help wanted
Projects
None yet
Development

No branches or pull requests

2 participants