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 | |
GSession * | Session |
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
-
session Session.
|
virtual |
Destructor.
Member Function Documentation
|
private |
Add a result in the container by verifying that it is not already there. Moreover, the highest weight is retain.
- Parameters
-
concept Concept to add. results Container to which concepts must be added. weight Weight associated to each concept found.
|
private |
|
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
-
str String to search for. results Container of concept references representing the possible concepts. It is cleared by the method. caller Identifier of the caller (for example a thread).
- Returns
- the number of concepts found.
|
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
-
query Query. node Node to analyse. caller Identifier of the caller (for example a thread).
Member Data Documentation
|
protected |
Session.
|
protected |
Internal data used by the extractor.