Forum Moderators: coopster & phranque

Message Too Old, No Replies

How to make a program to group keywords

         

twistydog

4:07 am on Aug 6, 2005 (gmt 0)

10+ Year Member



I'm not sure if CGI is the right place to post this. I think the program I'm looking for could be made in a few different ways. Basically I have huge lists of keywords that I'd like to be grouped easily. For example, let's say I have a 10,000 keyword list of dogs (one keyword phrase per line). I'd like to be able to type in one word such as poodle and have it return all the keyword phrases that have poodle anywhere in them. Could someone help me make a program for this?

Thanks in advance!
-Brad

KevinADC

12:00 am on Aug 7, 2005 (gmt 0)

10+ Year Member



sounds like a basic search engine. There are many scripts already written for this purpose, but which you might use if any depends on exactly what you are trying to do. Just returning the lines that contain the keyword is as simple as they come. Here is a link to a simple search engine:

[nms-cgi.sourceforge.net...]

scroll down the page to the "Simple Search" listing and download the zip or tar file.

twistydog

4:59 pm on Aug 7, 2005 (gmt 0)

10+ Year Member



The problem with all the search engine scripts that I have seen are that they search an entire website instead of just one .txt file. I just don't know enough about cgi coding to do it myself. If there's anyone out there that has some free time and can make the adjustments in this program I would be extremely grateful and may be able to pay them a little for their efforts.

-Brad

KevinADC

6:32 pm on Aug 7, 2005 (gmt 0)

10+ Year Member



if you want help then you need to describe what you are expecting the script to do and how it will be run.

Is it internet (cgi) or console (command line)?

Do you wish to only match whole words or partial words or both?

Should the results be in any specific type of order?

Here is a super basic example (command line) of what you want:


#!perl

print "Please enter a breed of dog:";

chomp (my $keyword = <STDIN>);

open(FH, 'path/to/list.txt') or die "Can't open list.txt: $!";
while(<FH>){
/\b$keyword\b/ and print;
}
close(FH);
exit;

twistydog

7:00 am on Aug 8, 2005 (gmt 0)

10+ Year Member



Kevin,
I sent you a PM on this.