#include <TextQueryRetMethod.hpp>
Inheritance diagram for lemur::api::TextQueryRetMethod:
Public Member Functions | |
TextQueryRetMethod (const Index &ind, ScoreAccumulator &accumulator) | |
virtual | ~TextQueryRetMethod () |
virtual TextQueryRep * | computeTextQueryRep (const TermQuery &qry)=0 |
compute the query representation for a text query (caller responsible for deleting the memory of the generated new instance) | |
virtual TextQueryRep * | computeTextQueryRep (DOCID_T docid) |
compute a query rep for an existing doc | |
virtual QueryRep * | computeQueryRep (const Query &qry) |
overriding abstract class method | |
virtual double | scoreDoc (const QueryRep &qry, DOCID_T docID) |
ooverriding abstract class method | |
virtual void | scoreCollection (const QueryRep &qry, IndexedRealVector &results) |
overriding abstract class method with a general efficient inverted index scoring procedure | |
virtual void | scoreCollection (DOCID_T docid, IndexedRealVector &results) |
add support for scoring an existing document against the collection | |
virtual DocumentRep * | computeDocRep (DOCID_T docID)=0 |
compute the doc representation (caller responsible for deleting the memory of the generated new instance) | |
virtual ScoreFunction * | scoreFunc ()=0 |
return the scoring function pointer | |
virtual void | updateQuery (QueryRep &qryRep, const DocIDSet &relDocs) |
update the query | |
virtual void | updateTextQuery (TextQueryRep &qryRep, const DocIDSet &relDocs)=0 |
Modify/update the query representation based on a set (presumably) relevant documents. | |
virtual void | scoreInvertedIndex (const QueryRep &qryRep, IndexedRealVector &scores, bool scoreAll=false) |
Efficient scoring with the inverted index. | |
virtual double | scoreDocVector (const TextQueryRep &qry, DOCID_T docID, lemur::utility::FreqVector &docVector) |
virtual double | scoreDocPassages (const TermQuery &qRep, DOCID_T docID, lemur::retrieval::PassageScoreVector &scores, int psgSize, int overlap) |
Score a query for each passage of a document. | |
Protected Attributes | |
ScoreAccumulator & | scAcc |
DocumentRep ** | docReps |
cache document reps. | |
bool | cacheDocReps |
whether or not to cache document representations | |
int | docRepsSize |
number of documents plus 1, the size of the docReps array. |
A text query retrieval method is determined by specifying the following elements:
Given a query q =(q1,q2,...,qN)
and a document d=(d1,d2,...,dN)
, where q1,...,qN
and d1,...,dN
are terms, TextQueryRetMethod
assumes the following general scoring function:
s(q,d) = g(w(q1,d1,q,d) + ... + w(qN,dN,q,d),q,d)That is, the score of a document
d
against a queryq
is a functiong
of the accumulated weightw
for each matched term.The score is thus determined by two functions
g
andw
; both may depend on the whole query or document. The functionw
gives the weight of each matched term, while the functiong
makes it possible to perform any further transformation of the sum of the weight of all matched terms based on the "summary" information of a query or a document (e.g., document length).
TextQueryRep
,DocumentRep
, andScoreFunction
are designed to support this general scoring function in the following way:A
ScoreFunction
is responsible for defining the two functionsg
andw
. ATextQueryRep
provides any information required for scoring from the query side (e.g., query term frequency). Similarly, aDocumentRep
provides any information required for scoring from the document side. Furthermore, aTextQueryRep
supports iteration over all query terms, allowing easy accumulation of weights over matched terms. The weighting functionw
and score adjustment functiong
typically assume and depend on some particular information and representation of the query and document, so a specificScoreFunction
(for a specific retrieval method) only works for some specificTextQueryRep
andDocumentRep
that are appropriate for the specific retrieval method.
Constructor & Destructor Documentation
|
Create the retrieval method. If cacheDocReps is true, allocate DocumentRep cache array. |
|
Destroy the object. If cacheDocReps is true, delete the DocumentRep cache array |
|
compute the doc representation (caller responsible for deleting the memory of the generated new instance)
Implemented in lemur::retrieval::CORIRetMethod, lemur::retrieval::CosSimRetMethod, lemur::retrieval::OkapiRetMethod, lemur::retrieval::SimpleKLRetMethod, and lemur::retrieval::TFIDFRetMethod. |
|
overriding abstract class method
Implements lemur::api::RetrievalMethod. |
|
compute a query rep for an existing doc
Reimplemented in lemur::retrieval::CosSimRetMethod. |
|
compute the query representation for a text query (caller responsible for deleting the memory of the generated new instance)
|
|
add support for scoring an existing document against the collection
|
|
overriding abstract class method with a general efficient inverted index scoring procedure
Reimplemented from lemur::api::RetrievalMethod. |
|
ooverriding abstract class method
Implements lemur::api::RetrievalMethod. |
|
Score a query for each passage of a document.
|
|
|
|
return the scoring function pointer
Implemented in lemur::retrieval::CORIRetMethod, lemur::retrieval::CosSimRetMethod, lemur::retrieval::OkapiRetMethod, lemur::retrieval::SimpleKLRetMethod, and lemur::retrieval::TFIDFRetMethod. |
|
Efficient scoring with the inverted index. a general scoring procedure shared by many different models (assuming "sortedScores has memory allocated) |
|
update the query
Implements lemur::api::RetrievalMethod. |
|
Modify/update the query representation based on a set (presumably) relevant documents.
|
|
whether or not to cache document representations
|
|
cache document reps.
|
|
number of documents plus 1, the size of the docReps array.
|
|
|