Search code examples
phpopen-sourcetextanalysis

Is there any open source text analysis library for PHP?


I am looking for a PHP library which does more or less the same thing as this webpage: http://textalyser.net/

I know that there are popular libraries in python and java, but I am looking for a PHP version. Thanks for your help!


Solution

  • Short Answer

    As far as I'm aware there's isn't one, or at least not a well-known / well-distributed one.

    Long Answer

    The closes de-facto code I've come across is php-text-statistics by Dave Child (since the PEAR version has been unmaintained for years) but that only takes care of readability and sentence, word and syllable counting. Any other data you'd have to get yourself with count_chars, str_word_count, substr_count, preg_match_all and the like. And of course some math skills to calculate all the percentages.

    That said, I'm not sure exactly what is it you'd want the library to do, or what http://textalyser.net/ does...
    (I mean what is a stoplist anyway? Or an exhaustive polyword phrase, for that matter...?)