Further to a request by the charming folks at STIS Towers, I knocked up a quick-and dirty text analysis tool.
The Lee Child Literary Fiction Detector (*)
I can’t claim any credit for it, really, because all of the grunt work was done by Dave Child at Added Bytes.
If you’re interested in PHP and, specifically OOP and classes, I’d encourage you to peruse Dave’s code – it’s clean, well documented and a fine example of how to use classes in PHP for good object-oriented design. I took the liberty of adding a function to the class that counts the number of occurrences of each word length and returns the results as a sorted array, with the option of padding missing values with zero occurrences. Handy for graphing.
I’ve added a nice pretty graph, too, using the excellent PHP/GD graphing tools at pChart.
Speaking of someone who comes from a firmy procedural background, I enjoy finding code like this as an example of something to aspire to. And, eventually, surpass. Natch
* it’s a long story