Help needed: Regexps (pattern matching) with hashes?! 
Author Message
 Help needed: Regexps (pattern matching) with hashes?!

Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------7DB7D44E63A30CD9CC8B7C9F
Content-Type: text/plain; charset=us-ascii
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit

Hi folks!

I'm in need of a hint or two:

I'm running a search-engine that searches a www-site using a hash that
contains the HTML-titles/links and all the words (That is the words are
the keys to html-file-numbers and the html-file-numbers are then
additionally the keys to the right html-file-locations, making the
search-engine quite simple). When a user types in a search, the
Perl-script looks for the search expressions as keys in this hash. This
all works fine and fast, but I wonder whether it would be possible to
look up the keys using pattern-matching, so that a search for "dogs"
will also reveal pages with the word "{*filter*}dogs" - so to say I'm wanting
something like $hash{/dogs/}, but surely this won't work.

Anyone can help me out there?!

Your answer appreciated,
Roman.

--------------7DB7D44E63A30CD9CC8B7C9F
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Visitenkarte fr Roman Bl?th
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Roman Bl?th
n:              Bl?th;Roman

note:           Gesch?ftl. bald unter: http://www.*-*-*.com/
=0A=
Schlosserstra?e 36
=0A=
D-44145 Dortmund
=0A=
Fax/Tel: (02 31) 83 02 73
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
end:            vcard

--------------7DB7D44E63A30CD9CC8B7C9F--



Thu, 30 Dec 1999 03:00:00 GMT  
 Help needed: Regexps (pattern matching) with hashes?!

!
! Hi folks!
!
! I'm in need of a hint or two:
!
! I'm running a search-engine that searches a www-site using a
! hash that contains the HTML-titles/links and all the words
! (That is the words are the keys to html-file-numbers and the
! html-file-numbers are then additionally the keys to the
! right html-file-locations, making the search-engine quite
! simple). When a user types in a search, the Perl-script
! looks for the search expressions as keys in this hash. This
! all works fine and fast, but I wonder whether it would be
! possible to look up the keys using pattern-matching, so that
! a search for "dogs" will also reveal pages with the word
! "{*filter*}dogs" - so to say I'm wanting something like
! $hash{/dogs/}, but surely this won't work.
!

you can get a list of the keys in the hash which contain
a search_pattern using grep:

%hash=(
   {*filter*}cats=>"no dogs here",
   {*filter*}dogs=>"something",
   hotdogs=>"something else",
   no_cats=>"not something"
   );

$search_pattern="dogs";


   print "$key: $hash{$key}\n";

Quote:
}

and surely there are other ways...this is just one that
springs to mind.

hope it helps
regards
andrew



Thu, 30 Dec 1999 03:00:00 GMT  
 Help needed: Regexps (pattern matching) with hashes?!


Quote:

> This all works fine and fast, but I wonder whether it would be
> possible to look up the keys using pattern-matching, so that a search
> for "dogs" will also reveal pages with the word "{*filter*}dogs" - so to
> say I'm wanting something like $hash{/dogs/}, but surely this won't
> work.

How about:


Hope this helps,

--Chris
--
     Chris Schleicher                      Office:  541/346-3998

                URL: http://www.*-*-*.com/ ~chrissch/



Fri, 31 Dec 1999 03:00:00 GMT  
 Help needed: Regexps (pattern matching) with hashes?!

Quote:

> =
> Hi folks!
> =
> I'm in need of a hint or two:
> =
> I'm running a search-engine that searches a www-site using a hash that
> contains the HTML-titles/links and all the words (That is the words are=

[snipped...]

There are free alternatives to writing your own search engine, but
if you really must, then what you descibe (dogs, {*filter*}dogs being the
same hash) sounds like you want a stemming algorithm; this is
a routine which takes, eg 'stemming','stemmed','stems' and finds the
common root word 'stem', then indexes this. AFAIK, this is how a
lot of the 'real' engines work.

You can find such a routine here:
http://www.*-*-*.com/ :8000/jimr/pe/MathSearch.html
Its part of 'Perigrinator', a perl search engine you
may consider as an alternative to your own...interesting code
in its own right.

Alternatively, get a hold of GLIMPSE:
http://www.*-*-*.com/ :1994/
A fast and widely used engine.

-- =

****=3D=3D=3D=3D----                                              Brian E=
wins. =

Fax: (44) 141 220 6100                          Tel: (44) 141 220 6121
 "It's time we face reality, my friends...
      We're not exactly rocket scientists." --Gary Larson ----=3D=3D=3D=3D=
****



Sat, 01 Jan 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. HELP: Need help with "pattern matching"

2. Need help on pattern matching

3. Need Help with Pattern Matching

4. i need help - pattern matching

5. Pattern matching - need help

6. Pattern Matching Help Needed

7. Need help with pattern matching

8. Need Help with Pattern Matching

9. pattern matching - need help

10. Pattern Matching Help Needed

11. Need Help: Pattern Matching Etc.

12. Newbie: Need RegExp pattern matching help

 

 
Powered by phpBB® Forum Software