Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Vector space search

by Anonymous Monk
on Dec 05, 2012 at 03:49 UTC ( #1007187=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Perl Monks, I am tring to use the module Search:VectorSpace to search for documents containing my query terms. But I'm not able to implement it. http://www.perl.com/pub/2003/02/19/engine.html

use Search::VectorSpace; my @docs = ...; my $engine = Search::VectorSpace->new( docs =>\@docs, threshol +d => .04); $engine->build_index(); while ( my $query = <> ) { my %results = $engine->search( $query ); print join "\n", keys %results; }
As mentioned in the module description above, I just need to place my document list in the @docs array. But on doing so, the search is happening only on the document names, but not the content. This is how I did it, is it right?
$dr="C:\\Users\\Desktop\\collection2"; opendir(DR, "$dr") || die "$!" ; @docs=<DR>; @docs=readdir DR;
I want it to search inside the document, not the document names.

Comment on Vector space search
Select or Download Code
Re: Vector space search
by Anonymous Monk on Dec 05, 2012 at 04:10 UTC

    I want it to search inside the document, not the document names.

    Then you should put the "inside the documents" inside the array instead of the "document names"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1007187]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2015-05-23 05:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (465 votes), past polls