2

For my blog i want to determine which words are the most used ones over a period of time and from all posts. I was searching for a plugin but all i got were plugins for overall stats.

6
  • 2
    the most popular words are "the" and "and" there is no reason to write a software for it ;) Feb 3, 2017 at 8:29
  • 😁 not the most helpful comment but you made me smile this morning
    – moeses
    Feb 3, 2017 at 8:33
  • 2
    lol, glad to do that, the longer form of that comment is that you first need to define what is it exactly what you want to count, as it is not that obvious when you think more about it, for example are shop and shops two different words? Feb 3, 2017 at 9:43
  • Also: Do you want to count post titles, body text, …?
    – kaiser
    Feb 3, 2017 at 12:48
  • 1
    I was looking for the same. I found one that gives you the top 20 keywords. But it seems to be not supported anymore since 2016. wordpress.org/plugins/word-stats no joy... Oct 9, 2019 at 14:58

1 Answer 1

1

This answer is just to put down a kind of roadmap. I think the question touches some machine learning concepts, you used the right "statistics" tag. You need to build a dictionary plugin learning from your new posts. Probably doing something like:

  • Manually create a first json filter dataset of most used words in your language (i.g. https://1000mostcommonwords.com/1000-most-common-english-words/). I didn't find an API for it. It would filter out all the words considered or which you consider irrelevant (like prepositions, pronouns, etc).
  • Write a function which process all the existing posts and export the content of your interest (description, titles, etc) in a second json dataset. You already have the post_metas to exploit, as database source. Remember to assign each content to the post_id because you'll need to handle updates or removals.
  • Create a function which updates that json on new post updated or published.
  • Define a gate comparing the previous 2 json sources, filtering out words and generating a new final json file to parse. You can use a declarative approach with array_map or array_filter built-in functions.
  • Finally, build a logic to count each word occurrence, store in a new database table and display it in a dashboard page.

I guess the parsing activity will become quite intense after a while, if the blog gets rich of contents and you often update your filter dataset. Let's have a look also to these library which could help:

Have fun and please share the outcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.