TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread 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)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
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.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
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: 175
Thanks: 9
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 Search this Thread
Search this Thread:

Advanced Search
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 10:12 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design