Concept Extractor. More...

#include <gconceptextractor.h>

Public Member Functions

 GConceptExtractor (GSession *session)
 
virtual size_t Search (const R::RString &str, R::RContainer< GConceptRef, true, true > &results, size_t caller)
 
virtual void Expand (GSearchQuery *query, GSearchQueryNode *node, size_t caller)
 
virtual ~GConceptExtractor (void)
 

Protected Attributes

GSessionSession
 
R::RThreadLocalStorage
< GConceptExtractorData
Datas
 

Private Member Functions

void AddResult (GConcept *concept, R::RContainer< GConceptRef, true, true > &results, double weight)
 
void SearchComplexConcept (const R::RString &token, GConceptExtractorData *data)
 

Detailed Description

Concept Extractor.

The GConceptExtractor class provides a mechanism to search for a set of concepts related to a given string or concept.

It is be used by GSearchQuery in the future to build a query.

Constructor & Destructor Documentation

GConceptExtractor ( GSession session)

Construct a concept extractor.

Parameters
sessionSession.
virtual ~GConceptExtractor ( void  )
virtual

Destructor.

Member Function Documentation

void AddResult ( GConcept concept,
R::RContainer< GConceptRef, true, true > &  results,
double  weight 
)
private

Add a result in the container by verifying that it is not already there. Moreover, the highest weight is retain.

Parameters
conceptConcept to add.
resultsContainer to which concepts must be added.
weightWeight associated to each concept found.
void SearchComplexConcept ( const R::RString token,
GConceptExtractorData data 
)
private
virtual size_t Search ( const R::RString str,
R::RContainer< GConceptRef, true, true > &  results,
size_t  caller 
)
virtual

Find a set of concepts related to a given string. For each possible concept, a weight is associated (through the GConceptRef class) that represents a sort of probability.

When the string contains only one token, all the different existing stems are added with a weight of 1.0.

For expressions, the extractor searches for a matching once stopwords are removed and stemming is done. A weight corresponds to the amount of tokens defining the corresponding expression that are contained in the string.

Parameters
strString to search for.
resultsContainer of concept references representing the possible concepts. It is cleared by the method.
callerIdentifier of the caller (for example a thread).
Returns
the number of concepts found.
virtual void Expand ( GSearchQuery query,
GSearchQueryNode node,
size_t  caller 
)
virtual

Look if a query node can be expanded with better options (or a set of better options). For example, one may decide that a given thesaurus should be preferred, and that other concepts should be replace if possible.

By default, this methods does nothing.

Parameters
queryQuery.
nodeNode to analyse.
callerIdentifier of the caller (for example a thread).

Member Data Documentation

GSession* Session
protected

Session.

Internal data used by the extractor.