Advertisement:

Author Topic: New Idea  (Read 8194 times)

Offline DoctorToxn

  • Semi-Newbie
  • *
  • Posts: 56
    • Dtronix
New Idea
« on: March 27, 2005, 04:30:51 PM »
I was just browsing your forum and say that there were like 226148 topics in the forum.  And I was wondering, how many words that are in those 226148.  I think in the next release, that there should be a "Total Words" statistic.  I think that would be cool if it didn’t take too long to compile and display.  Just an idea.

BuilderDan

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,872
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: New Idea
« Reply #1 on: March 27, 2005, 05:40:27 PM »
I think this would be better as a mod, but PHP does have a built-in function that sort of does this - see http://www.php.net/str_word_count for more details.
Michael Eshom
Cincy Space - now open!

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: New Idea
« Reply #2 on: March 27, 2005, 05:47:18 PM »
Indeed, this is very hard to keep track of. Every time a post is edited/deleted you'd need to update the total. Also, counting all the totals at once would be overwealming on anything except a small board. One thing you could easily do is look at the size of the messages table, and "guess" the amount of words based on the physical size it occupies.
I'm only a half geek really...

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,872
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: New Idea
« Reply #3 on: March 27, 2005, 05:55:56 PM »
Now that you mention it, this could get a bit complicated. It would indeed be a killer for large boards to count words for existing messages, and then you'd have to strip out everything you didn't want counted as a word (HTML code, bbcode tags and smiley codes) before counting them. Otherwise, you could just add something to the post2() function to have it count the words everytime a new post was made or one was edited.
« Last Edit: March 27, 2005, 05:58:44 PM by Oldiesmann »
Michael Eshom
Cincy Space - now open!

Offline DoctorToxn

  • Semi-Newbie
  • *
  • Posts: 56
    • Dtronix
Re: New Idea
« Reply #4 on: March 27, 2005, 06:06:55 PM »
I know that it could get very confusing in the coding in recounting EVERY view especially in large forums.  So what about having a second post function that counts and adds that number to an existing number in a SQL row.  Same with editing, Add or subtract the number of words edited or added to that SQL row. (Like a counter, Except with subtraction also.)

BuilderDan

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: New Idea
« Reply #5 on: March 27, 2005, 06:12:31 PM »
It's that infamous trade off between effort and usefulness. Sure, you could do that, but it would be a hell of a lot of work for very little benefit. Personally, I'd just work out the average words per message once, then times that by the number of messages you have - not accurate but a reasonable guess.
I'm only a half geek really...

Offline DoctorToxn

  • Semi-Newbie
  • *
  • Posts: 56
    • Dtronix
Re: New Idea
« Reply #6 on: March 27, 2005, 06:14:14 PM »
Can you do that in php?

BuilderDan

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: New Idea
« Reply #7 on: March 27, 2005, 06:21:48 PM »
Well, what I would do is create a little PHP script that you run once you have a fairly busy board, which will count up the total words in ALL your messages, and divide this by the number of messages, to give you an average words/message figure. Now, you could then just use this figure to display the total amount of words on your board by doing something like:
$totalWords = $modSettings['totalPosts'] * 24.646;

Where 24.646 would be whatever the average amount was. You could run the little PHP script every so often to get a more accurate value (Indeed you could store this "value" in the SMF settings table)

The problem is the little PHP script would not be an easy write if you had lots of messages (>5000). You'd need to have it fetch maybe 500 at a time and add code to stop it timing out, as it would be a demanding job I suspect. Think this is best going in Mod Requests as it's not going to make it as a built in feature I'm afraid :)
I'm only a half geek really...

Offline DoctorToxn

  • Semi-Newbie
  • *
  • Posts: 56
    • Dtronix
Re: New Idea
« Reply #8 on: March 27, 2005, 06:32:24 PM »
Well thanks.  I might do that sometime.  It was just an idea.

BuilderDan

Offline Amacythe

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,060
  • Gender: Female
Re: New Idea
« Reply #9 on: March 27, 2005, 07:59:34 PM »
It's that infamous trade off between effort and usefulness. Sure, you could do that, but it would be a hell of a lot of work for very little benefit. Personally, I'd just work out the average words per message once, then times that by the number of messages you have - not accurate but a reasonable guess.

After all, who's going to go through every post and count the words to prove your stats wrong? ;)

Offline DoctorToxn

  • Semi-Newbie
  • *
  • Posts: 56
    • Dtronix
Re: New Idea
« Reply #10 on: March 27, 2005, 08:07:16 PM »
After all, who's going to go through every post and count the words to prove your stats wrong? ;)

Good point.

BuilderDan