TalkPHP
 
 
Account Login
Latest Articles
» cURL Basics
» Securing your PHP applications Part 1
» The way the function rolls
» Database Abstraction with Zend_Db - Part 2
» CSRF POST Token Protection
Advertisement
Associates
Associates
techtuts Darkmindz
CSS Tutorials Tutorialsphere.com - Free Online Tutorials
Boston PHP SurfnLearn
Reply
 
LinkBack Thread Tools Display Modes
Old 05-12-2008, 02:03 PM   #1 (permalink)
The Visitor
 
Join Date: May 2008
Posts: 2
Thanks: 0
codingwizard is on a distinguished road
Confused Suggestions to a users question

Hi all!

I'm looking to find out the best way to give a list of suggested answers to a user when they enter a question. For example like Kayako does when a user enters text for a new support ticket.

Is there some magical way of matching accurately or is it just a case of going through each word in the users text word by word and matching articles, seeing which match the most, sorting in ascending order and then displaying them?

Any help or guidance is appreciated.
codingwizard is offline  
Reply With Quote
Old 05-12-2008, 03:25 PM   #2 (permalink)
The Acquainted
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 108
Thanks: 14
ETbyrne is on a distinguished road
Default

You could have a list and as the user types in it looks at the list for any matches like if you type in can't then you get a list like can't log in, can't do this, can't do that.
__________________
There is no place like 127.0.0.1
ETbyrne is offline  
Reply With Quote
Old 05-14-2008, 04:33 PM   #3 (permalink)
The Visitor
 
Join Date: May 2008
Posts: 2
Thanks: 0
codingwizard is on a distinguished road
Default

Yes, but the user is going to be entering a paragraph of text for their question and then it needs to display matching articles from the KB using an Ajax search. Surely searching for articles with every word wouldn't be accurate - how do we rate how much an article matches the question entered - like a relevance score with more matches = higher relevance?
codingwizard is offline  
Reply With Quote
Old 05-14-2008, 07:33 PM   #4 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 103
Thanks: 7
drewbee is on a distinguished road
Default

Here is how I would do it.

Step 1) Strip out common, unidentifable words to the article IE: and, but, I, we, are etc etc.
Step 2) out of each article, build an index of total words and how many times it appeared in the article.
Step 3) do the same for the new article being listed (build index of words & count)
Step 4) Find all keywords in new article which have a count greater then 3, then query against all of our previously submited articles of which contain all of the previously said keywords.
Step 5) Sort relevance by the articles which matched the most keywords from article new to article old

I personally would never do this with ajax though... way to resource intensive. I would only run this type of algorithim only when a new article is added, and cache the results in the database, in a new table containing a 1 > many relationship (article > related articles).
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:36 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0