Interface for building the automaton for detecting patterns in text.
More...
#include <patternMatcherInstanceInterface.hpp>
|
virtual | ~PatternMatcherInstanceInterface () |
| Destructor. More...
|
|
virtual void | defineOption (const std::string &name, double value)=0 |
| Define an option value for the compilation. More...
|
|
virtual void | defineTermFrequency (unsigned int termid, double df)=0 |
| Define a relative document term frequency used for optimization of the automaton. More...
|
|
virtual void | pushTerm (unsigned int termid)=0 |
| Push a term on the stack. More...
|
|
virtual void | pushExpression (JoinOperation operation, std::size_t argc, unsigned int range, unsigned int cardinality)=0 |
| Take the topmost elements from the stack, build an expression out of them and replace the argument elements with the created element on the stack. More...
|
|
virtual void | pushPattern (const std::string &name)=0 |
| Push a reference to a pattern on the stack. More...
|
|
virtual void | attachVariable (const std::string &name)=0 |
| Attaches a variable to the top expression or term on the stack. More...
|
|
virtual void | definePattern (const std::string &name, const std::string &formatstring, bool visible)=0 |
| Create a pattern that can be referenced by the given name and can be declared as part of the result. More...
|
|
virtual bool | compile ()=0 |
| Compile all patterns defined. More...
|
|
virtual
PatternMatcherContextInterface * | createContext () const =0 |
| Create the context to process a document with the pattern matcher. More...
|
|
virtual analyzer::FunctionView | view () const =0 |
| Get the definition of the function as structure for introspection. More...
|
|
Interface for building the automaton for detecting patterns in text.
Join operations (similar meaning as in query evaluation)
Enumerator |
---|
OpSequence |
The argument patterns must appear in the specified (strict) order (ordinal span) within a specified proximity range of ordinal positions for the completion of the rule.
|
OpSequenceImm |
Same as OpSequence, but does not allow any gap in between the elements.
|
OpSequenceStruct |
The argument patterns must appear in the specified (strict) order (ordinal span) within a specified proximity range of ordinal positions for the completion of the rule without a structure element appearing before the last argument pattern needed for then completion of the rule.
|
OpWithin |
The argument patterns must appear within a specified proximity range of ordinal positions without overlapping ordinal spans for the completion of the rule.
|
OpWithinStruct |
The argument patterns must appear within a specified proximity range of ordinal positions without overlapping ordinal spans for the completion of the rule without a structure element appearing before the last element for then completion of the rule.
|
OpAny |
At least one of the argument patterns must appear for the completion of the rule.
|
OpAnd |
All of the argument patterns must appear for the completion of the rule at the same ordinal position.
|
virtual strus::PatternMatcherInstanceInterface::~PatternMatcherInstanceInterface |
( |
| ) |
|
|
inlinevirtual |
virtual void strus::PatternMatcherInstanceInterface::attachVariable |
( |
const std::string & |
name | ) |
|
|
pure virtual |
Attaches a variable to the top expression or term on the stack.
- Parameters
-
[in] | name | name of the variable attached |
virtual bool strus::PatternMatcherInstanceInterface::compile |
( |
| ) |
|
|
pure virtual |
Compile all patterns defined.
- Parameters
-
[in] | opt | optimization options |
- Note
- Tries to optimize the program if possible by setting initial key events of the programs to events that are relative rare
Create the context to process a document with the pattern matcher.
- Returns
- the pattern matcher context
virtual void strus::PatternMatcherInstanceInterface::defineOption |
( |
const std::string & |
name, |
|
|
double |
value |
|
) |
| |
|
pure virtual |
Define an option value for the compilation.
- Parameters
-
[in] | name | option name |
[in] | value | option value |
virtual void strus::PatternMatcherInstanceInterface::definePattern |
( |
const std::string & |
name, |
|
|
const std::string & |
formatstring, |
|
|
bool |
visible |
|
) |
| |
|
pure virtual |
Create a pattern that can be referenced by the given name and can be declared as part of the result.
- Parameters
-
[in] | name | name of the pattern and the result if declared as visible |
[in] | formatstring | format string for the value associated with the pattern (empty if undefined). The formatstring contains variable references to pattern parts in curly brackets '{' '}'. A variable reference is an identifier optionally followed by an or '|' and a separator value used for separate multiple occurrencies of the referenced variable. |
[in] | visible | true, if the pattern result should be exported (be visible in the final result) |
virtual void strus::PatternMatcherInstanceInterface::defineTermFrequency |
( |
unsigned int |
termid, |
|
|
double |
df |
|
) |
| |
|
pure virtual |
Define a relative document term frequency used for optimization of the automaton.
- Parameters
-
[in] | termid | term identifier |
[in] | df | document frequency (only compared relatively, value between 0 and a virtual collection size) |
static const char* strus::PatternMatcherInstanceInterface::joinOperationName |
( |
JoinOperation |
op | ) |
|
|
inlinestatic |
virtual void strus::PatternMatcherInstanceInterface::pushExpression |
( |
JoinOperation |
operation, |
|
|
std::size_t |
argc, |
|
|
unsigned int |
range, |
|
|
unsigned int |
cardinality |
|
) |
| |
|
pure virtual |
Take the topmost elements from the stack, build an expression out of them and replace the argument elements with the created element on the stack.
- Parameters
-
[in] | operation | identifier of the operation to perform as string |
[in] | argc | number of arguments of this operation |
[in] | range | position proximity range of the expression |
[in] | cardinality | specifies a result dimension requirement (e.g. minimum number of elements of any input subset selection that builds a result) (0 for use default). Interpretation depends on operation, but in most cases it specifies the required size for a valid result. |
- Note
- The operation identifiers should if possible correspond to the names used for the standard posting join operators in the query evaluation of the strus core.
virtual void strus::PatternMatcherInstanceInterface::pushPattern |
( |
const std::string & |
name | ) |
|
|
pure virtual |
Push a reference to a pattern on the stack.
- Parameters
-
[in] | name | name of the referenced pattern |
virtual void strus::PatternMatcherInstanceInterface::pushTerm |
( |
unsigned int |
termid | ) |
|
|
pure virtual |
Push a term on the stack.
- Parameters
-
[in] | termid | term identifier |
Get the definition of the function as structure for introspection.
- Returns
- structure for introspection
The documentation for this class was generated from the following file: