ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
meta::analyzers::filters::length_filter Class Reference

Filter that only retains tokens that are within a certain length range, inclusive. More...

#include <length_filter.h>

Inheritance diagram for meta::analyzers::filters::length_filter:
meta::util::multilevel_clonable< Root, Base, Derived >

Public Member Functions

 length_filter (std::unique_ptr< token_stream > source, uint64_t min, uint64_t max)
 Constructs a length filter, reading tokens from the given source and eliminating any that are shorter than min characters in length or longer than max characters in length. More...
 
 length_filter (const length_filter &other)
 Copy constructor. More...
 
void set_content (const std::string &content) override
 Sets the content for the beginning of the filter chain. More...
 
std::string next () override
 
 operator bool () const override
 Determines whether there are more tokens available in the stream.
 
- Public Member Functions inherited from meta::util::multilevel_clonable< Root, Base, Derived >
virtual std::unique_ptr< Root > clone () const
 Clones the given object. More...
 

Static Public Attributes

static const std::string id = "length"
 Identifier for this filter.
 

Private Member Functions

void next_token ()
 Advances internal state to the next valid token.
 

Private Attributes

std::unique_ptr< token_streamsource_
 The source to read tokens from.
 
util::optional< std::string > token_
 The next buffered token.
 
uint64_t min_length_
 The minimum length of a token that can be emitted by this filter.
 
uint64_t max_length_
 The maximum length of a token that can be emitted by this filter.
 

Detailed Description

Filter that only retains tokens that are within a certain length range, inclusive.

Constructor & Destructor Documentation

meta::analyzers::filters::length_filter::length_filter ( std::unique_ptr< token_stream source,
uint64_t  min,
uint64_t  max 
)

Constructs a length filter, reading tokens from the given source and eliminating any that are shorter than min characters in length or longer than max characters in length.

Parameters
sourceWhere to read tokens from
minThe minimum token length
maxThe maximum token length
meta::analyzers::filters::length_filter::length_filter ( const length_filter other)

Copy constructor.

Parameters
otherThe length_filter to copy into this one

Member Function Documentation

void meta::analyzers::filters::length_filter::set_content ( const std::string &  content)
override

Sets the content for the beginning of the filter chain.

Parameters
contentThe string content to set
std::string meta::analyzers::filters::length_filter::next ( )
override
Returns
the next token in the sequence

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