strusAnalyzer  0.17
Public Member Functions | List of all members
strus::SegmenterContextInterface Class Referenceabstract

Defines the context for segmenting one document. More...

#include <segmenterContextInterface.hpp>

Public Member Functions

virtual ~SegmenterContextInterface ()
 Destructor. More...
 
virtual void putInput (const char *chunk, std::size_t chunksize, bool eof)=0
 Feed the segmenter with the next chunk of input to process. More...
 
virtual bool getNext (int &id, SegmenterPosition &pos, const char *&segment, std::size_t &segmentsize)=0
 Fetch the next text segment. More...
 

Detailed Description

Defines the context for segmenting one document.

Constructor & Destructor Documentation

virtual strus::SegmenterContextInterface::~SegmenterContextInterface ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual bool strus::SegmenterContextInterface::getNext ( int &  id,
SegmenterPosition pos,
const char *&  segment,
std::size_t &  segmentsize 
)
pure virtual

Fetch the next text segment.

Parameters
[out]ididentifier of the expression that addresses the text segment (defined with SegmenterInterface::defineSelectorExpression(int, const std::string&) or with SegmenterInterface::defineSubSection(int,int,const std::string&))
[out]posposition of the segment in the original source
[out]segmentpointer to the start of the segment.
[out]segmentsizesize of segment in bytes
Returns
true, if a valid segment could be returned, false in case of no segments left or more required to be fed
Remarks
the segments must be delivered in ascending order of positions. Segments with same position can be returned in any order
Note
returned chunks only valid after the call, owned by the segmenter
virtual void strus::SegmenterContextInterface::putInput ( const char *  chunk,
std::size_t  chunksize,
bool  eof 
)
pure virtual

Feed the segmenter with the next chunk of input to process.

Parameters
[in]chunkpointer to input chunk to process (to copy by this)
[in]chunksizesize of input chunk to process in bytes
[in]eoftrue, if this is the last chunk to feed
Remarks
the buffer passed to this must be copied by the segmenter, because it is not guaranteed to survive till the next call of putInput.

The documentation for this class was generated from the following file: