strusAnalyzer  0.17
patternLexerInstanceInterface.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_ANALYZER_PATTERN_LEXER_INSTANCE_INTERFACE_HPP_INCLUDED
11 #define _STRUS_ANALYZER_PATTERN_LEXER_INSTANCE_INTERFACE_HPP_INCLUDED
14 #include <string>
15 
16 namespace strus
17 {
18 
20 class PatternLexerContextInterface;
21 
24 {
25 public:
28 
32  virtual void defineOption( const std::string& name, double value)=0;
33 
38  virtual void defineLexemName( unsigned int id, const std::string& name)=0;
39 
47  virtual void defineLexem(
48  unsigned int id,
49  const std::string& expression,
50  unsigned int resultIndex,
51  unsigned int level,
52  analyzer::PositionBind posbind)=0;
53 
59  virtual void defineSymbol(
60  unsigned int id,
61  unsigned int lexemid,
62  const std::string& name)=0;
63 
69  virtual unsigned int getSymbol(
70  unsigned int lexemid,
71  const std::string& name) const=0;
72 
76  virtual const char* getLexemName( unsigned int id) const=0;
77 
81  virtual bool compile()=0;
82 
87 
90  virtual analyzer::FunctionView view() const=0;
91 };
92 
93 } //namespace
94 #endif
95 
virtual const char * getLexemName(unsigned int id) const =0
Retrieve the name given to a lexem or symbol.
Structure describing the internal representation of a normalizer/tokenizer/aggregator function in the...
Interface for building the automaton for detecting lexems used as basic entities by pattern matching ...
Definition: patternLexerInstanceInterface.hpp:23
PositionBind
Determines how document ordinal positions are assigned to terms.
Definition: positionBind.hpp:20
Structure describing the internal representation of a normalizer/tokenizer/aggregator function in the...
Definition: functionView.hpp:29
virtual ~PatternLexerInstanceInterface()
Destructor.
Definition: patternLexerInstanceInterface.hpp:27
virtual bool compile()=0
Compile all patterns and symbols defined.
virtual void defineLexemName(unsigned int id, const std::string &name)=0
Assign a name to a lexem or symbol identifier.
virtual void defineSymbol(unsigned int id, unsigned int lexemid, const std::string &name)=0
Define a symbol, an instance of a basic lexem, that gets a different id than the basic lexem...
virtual void defineOption(const std::string &name, double value)=0
Define an option value for the compilation.
virtual unsigned int getSymbol(unsigned int lexemid, const std::string &name) const =0
Get the value of a defined symbol.
Interface for detecting lexems used as basic entities by pattern matching in text.
Definition: patternLexerContextInterface.hpp:19
virtual PatternLexerContextInterface * createContext() const =0
Create the context to process a chunk of text with this text matcher.
virtual void defineLexem(unsigned int id, const std::string &expression, unsigned int resultIndex, unsigned int level, analyzer::PositionBind posbind)=0
Define a pattern for detecting a basic lexem of this pattern matching lexer.
virtual analyzer::FunctionView view() const =0
Get the definition of the function as structure for introspection.