PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2009-02-10 00:20:09

Cyclone103
Member
From: Antarctica
Registered: 2008-10-08
Posts: 37
Website

Mod: Word Cloud

I would like a mod that creates a word cloud of X words from any forums that someone in their usergroup could see, like admins can see words in admin-only forums.

If possible, make it run a search for that word to show some occurrences if the word is clicked, and size them by usage count and relative to the max and min based off of the number of words, if that makes sense...

Is this easy, or even possible?

Offline

 

#2 2009-02-21 04:58:05

Cyclone103
Member
From: Antarctica
Registered: 2008-10-08
Posts: 37
Website

Re: Mod: Word Cloud

Sorry to bump this, but its been 11 days.

Any ideas yet?

Offline

 

#3 2009-03-01 21:50:11

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: Mod: Word Cloud

This wouldn't be a difficult mod to create. One could make use of the 'punbb_search_matches' table - for counting the number of occurrence of words in the forum, and then maybe display a list of 20 most frequently occurring words. You can search Hot Scripts for "tag cloud" to get some ideas.

I am not sure what you mean by "size them by usage count".

Offline

 

#4 2009-03-06 16:14:58

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: Mod: Word Cloud

Koos wrote:

I am not sure what you mean by "size them by usage count".

The words are usually graduated in size depending upon their frequency/popularity etc. in the ones I've seen.

Offline

 

#5 2009-03-08 11:31:16

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: Mod: Word Cloud

Let's say you set up a word/tag cloud with the most frequently occurring words in the forum  - where will you link them to?

Offline

 

#6 2009-03-09 00:32:32

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: Mod: Word Cloud

I think the O.P's general idea was a random selection of search results? The size then being an indicator of times clicked.

Seems pointless personally. Plus I absolutely detest those tag clouds. big_smile

Offline

 

#7 2009-03-10 02:53:01

Cyclone103
Member
From: Antarctica
Registered: 2008-10-08
Posts: 37
Website

Re: Mod: Word Cloud

Koos wrote:

Let's say you set up a word/tag cloud with the most frequently occurring words in the forum  - where will you link them to?

A search for them inside the forums, displayed as posts.

MattF wrote:

The size then being an indicator of times clicked.

I meant the number of times it is found inside the forum.

I can't exactly make this myself, I know almost no PHP.

Offline

 

#8 2009-03-10 20:39:15

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: Mod: Word Cloud

Cyclone103 wrote:

I meant the number of times it is found inside the forum.

Seriously? This idea would kill your performance completely. Be hopes you're not on a shared host if you're planning on using something like this.

Offline

 

#9 2009-03-17 19:56:38

Cyclone103
Member
From: Antarctica
Registered: 2008-10-08
Posts: 37
Website

Re: Mod: Word Cloud

It cannot return a simple integer for the number of times it is found?

Okay, then the click popularity works too.

Offline

 

#10 2009-03-18 00:35:18

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: Mod: Word Cloud

Cyclone103 wrote:

It cannot return a simple integer for the number of times it is found?

Yup. The thing is, however, (and I may be missing an easier method, granted), that each word would have to be calculated for each result returned. That could end up being a fairly intensive calculation process.

Offline

 

#11 2009-03-18 20:37:34

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: Mod: Word Cloud

Actually not that difficult. Assuming that your table prefix is punbb_ you can use the following mysql query:

Code:

SELECT DISTINCT(m.word_id), count(*) AS count, w.word FROM punbb_search_matches as m LEFT JOIN punbb_search_words AS w ON w.id=m.word_id GROUP BY m.word_id ORDER BY count DESC LIMIT 20

To exclude those short words like "and", "or" etc from the list, you can use the following instead:

Code:

SELECT DISTINCT(m.word_id), count(*) AS count, w.word FROM punbb_search_matches as m LEFT JOIN punbb_search_words AS w ON w.id=m.word_id WHERE CHAR_LENGTH(w.word) > 3 GROUP BY m.word_id ORDER BY count DESC LIMIT 20

This will generate a table displaying the 20 most frequently occurring words in the forum.

You might want to play around a bit with the query, e.g. use CHAR_LENGTH(w.word) > 4 instead.

Offline

 

#12 2009-03-19 00:20:19

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: Mod: Word Cloud

Koos wrote:

This will generate a table displaying the 20 most frequently occurring words in the forum.

Most frequently searched words, shouldn't that be? One point to note. I believe that method would only work for MySQL(i), btw. I seem to remember that PgSQL searches don't use those tables. (I may be wrong on that, however). smile

Offline

 

#13 2009-03-26 03:35:33

Cyclone103
Member
From: Antarctica
Registered: 2008-10-08
Posts: 37
Website

Re: Mod: Word Cloud

I am running MySQL, and what do I do if my prefix is not punbb?

Offline

 

#14 2009-03-28 14:58:14

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: Mod: Word Cloud

Change:

Code:

FROM punbb_search_matches

to:

Code:

FROM '.$db->prefix.'search_matches

Replace all instances of punbb_ with that db->prefix part, (including the single quotes and dots).

Last edited by MattF (2009-03-28 14:59:37)

Offline

 

#15 2009-03-31 00:56:32

Cyclone103
Member
From: Antarctica
Registered: 2008-10-08
Posts: 37
Website

Re: Mod: Word Cloud

Cool, thanks! And of course, I should include the header and footer and the rest of that page to make this work, right?

Last edited by Cyclone103 (2009-03-31 00:57:44)

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.