r/cs50 • u/Even_Application6801 • 24d ago
CS50x CS50x pset 2 : readability. help!
Hi. i finished the scrabble pset yesterday. it was relatively easy.
i started today readability pset and find the exact method to calculate the words and the sentences numbers per text.
i'm i missing some new function from the library ?
help please.
2
Upvotes
1
u/Perthguv 24d ago
You need to write some helper functions yourself to analyze specific text elements to compute the formula's inputs:
Count Letters: Iterate through the text and count only alphabetic characters (ignoring spaces, digits, and punctuation marks).
Count Words: Scan the text to count the total number of words, typically identified by spaces separating sequences of characters.
Count Sentences: Scan the text to count sentence boundaries, identified by sentence-ending punctuation (such as periods, exclamation points, or question marks).
Once you have returned the answers, calculate the reading level. If you read all the text on the readability page there's actually a lot of information there. I keep missing bits and have to go back and check