| | |
Compare 2 Lists of Words
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Aug 2005
Posts: 279
Reputation:
Solved Threads: 6
(additional info)
I have not entered the data yet. So I'm open to just about anything. Here's what I'm planning.
(this part I have)
html form: user enters url
php: visits url and extracts the keywords and description meta tag values.
(I don't have this)
mysql:[table: 2 columns: column1 & column2] column1- phrase or one word
colum2- list of keywords relative to column1
Essentially, the php will visit the site, extract the keywords and compare them to the database keywords (column2) counting the number of matches. The php will return the column1 value for the column2 value that returned the most matches.
I have not entered the data yet. So I'm open to just about anything. Here's what I'm planning.
(this part I have)
html form: user enters url
php: visits url and extracts the keywords and description meta tag values.
(I don't have this)
mysql:[table: 2 columns: column1 & column2] column1- phrase or one word
colum2- list of keywords relative to column1
Essentially, the php will visit the site, extract the keywords and compare them to the database keywords (column2) counting the number of matches. The php will return the column1 value for the column2 value that returned the most matches.
For simply comparing 2 lists of words for matches, I'd leave the database out of it. You can store your results or the keywords in the database if you want, but for the actual comparison, check out PHP's array_diff() function.
http://www.php.net/manual/en/function.array-diff.php
PS: For the part where you retrieve the headers and meta tags of the pages server-side, I know you said you had this working, but my class_http would make that job quite easy. It's a robust screen-scraping class and even supports making WebDAV requests. It is very easy to use.
http://www.troywolf.com/articles/php/class_http/
http://www.php.net/manual/en/function.array-diff.php
PS: For the part where you retrieve the headers and meta tags of the pages server-side, I know you said you had this working, but my class_http would make that job quite easy. It's a robust screen-scraping class and even supports making WebDAV requests. It is very easy to use.
http://www.troywolf.com/articles/php/class_http/
•
•
Join Date: Aug 2005
Posts: 279
Reputation:
Solved Threads: 6
Troy,
Thanks a lot for the response. I was wondering if anyone was going to respond.
Some things have changed since my last post. I have about 155+ categories (individual names) and each has a list of keywords.
I'll want to compare one list of keywords with each of the category’s lists. I've already designed the database structure (normalized, I think), so I'm not so worried about that any longer.
As for the tag extractor, I have a very simple solution:
[PHP]while (!feof ($fp))
{
$buf = trim(fgets($fp, 4096));
$cont .= $buf;
}
preg_match("/$start(.*)$end/s",$cont,$match);
echo 'Title<br>';
echo $match[1];
echo '<br><br>';
echo 'URL<br>';[/PHP]
Thanks a lot for the response. I was wondering if anyone was going to respond.
Some things have changed since my last post. I have about 155+ categories (individual names) and each has a list of keywords.
I'll want to compare one list of keywords with each of the category’s lists. I've already designed the database structure (normalized, I think), so I'm not so worried about that any longer.
As for the tag extractor, I have a very simple solution:
[PHP]while (!feof ($fp))
{
$buf = trim(fgets($fp, 4096));
$cont .= $buf;
}
preg_match("/$start(.*)$end/s",$cont,$match);
echo 'Title<br>';
echo $match[1];
echo '<br><br>';
echo 'URL<br>';[/PHP]
![]() |
Similar Threads
- Reading from a file question (Python)
- need help comparing bits (Python)
- In Need of a Script (C)
- making sorted lists (was: Help Me!) (C)
Other Threads in the MySQL Forum
- Previous Thread: Multiple results
- Next Thread: HELP! MySQL with phpMyAdmin 2.5.5-p\1
| Thread Tools | Search this Thread |
Tag cloud for MySQL
1 agplv3 alfresco api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright court crm data database design developer development distinct dui eliminate email enter enterprise error eudora facebook form foss gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron microsoft microsoftexchange montywidenius multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opengovernment opensource operand oracle penelope php query referencedesign reorderingcolumns results resultset saas search select sharepoint simpledb sourcecode spotify statement sugarcrm syntax techsupport thunderbird transparency update virtualization





