Colibri Core
|
A pattern model based on an unordered set, does not hold data, only patterns. Very suitable for loading constraint models. More...
#include <patternmodel.h>
Public Types | |
typedef PatternSet< uint64_t >::iterator | iterator |
typedef PatternSet< uint64_t >::const_iterator | const_iterator |
Public Types inherited from PatternSet< uint64_t > | |
typedef t_patternset::iterator | iterator |
typedef t_patternset::const_iterator | const_iterator |
Public Types inherited from PatternStore< t_patternset, uint64_t, Pattern > | |
typedef t_patternset::iterator | iterator |
typedef t_patternset::const_iterator | const_iterator |
Public Member Functions | |
PatternSetModel () | |
PatternSetModel (std::istream *f, PatternModelOptions options, PatternModelInterface *constrainmodel=NULL) | |
PatternSetModel (const std::string &filename, const PatternModelOptions &options, PatternModelInterface *constrainmodel=NULL) | |
virtual int | getmodeltype () const |
virtual int | getmodelversion () const |
virtual size_t | size () const |
virtual bool | has (const Pattern &pattern) const |
virtual bool | has (const PatternPointer &pattern) const |
virtual void | load (std::string &filename, const PatternModelOptions &options, PatternModelInterface *constrainmodel=NULL) |
virtual void | load (std::istream *f, const PatternModelOptions &options, PatternModelInterface *constrainmodel=NULL) |
void | write (std::ostream *out) |
void | write (const std::string &filename) |
PatternModelInterface * | getinterface () |
virtual unsigned int | occurrencecount (const Pattern &pattern) |
virtual double | frequency (const Pattern &) |
virtual int | maxlength () const |
virtual int | minlength () const |
virtual unsigned int | types () |
virtual unsigned int | tokens () const |
unsigned char | type () const |
unsigned char | version () const |
Public Member Functions inherited from PatternSet< uint64_t > | |
PatternSet () | |
PatternSet (const ClassDecoder &classdecoder) | |
PatternSet (const ClassEncoder &classencoder) | |
virtual | ~PatternSet () |
void | insert (const Pattern &pattern) |
bool | has (const Pattern &pattern) const |
bool | has (const PatternPointer &pattern) const |
size_t | size () const |
void | reserve (size_t s) |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
iterator | find (const Pattern &pattern) |
const_iterator | find (const Pattern &pattern) const |
iterator | find (const PatternPointer &pattern) |
const_iterator | find (const PatternPointer &pattern) const |
bool | erase (const Pattern &pattern) |
iterator | erase (const_iterator position) |
void | write (std::ostream *out) |
void | read (std::istream *in, int MINLENGTH=0, int MAXLENGTH=999999, PatternStoreInterface *constrainstore=NULL, bool DONGRAMS=true, bool DOSKIPGRAMS=true, bool DOFLEXGRAMS=true) |
void | readmap (std::istream *in, int MINTOKENS=0, int MINLENGTH=0, int MAXLENGTH=999999, PatternStoreInterface *constrainstore=NULL, bool DONGRAMS=true, bool DOSKIPGRAMS=true, bool DOFLEXGRAMS=true) |
Public Member Functions inherited from PatternStore< t_patternset, uint64_t, Pattern > | |
PatternStore () | |
virtual | ~PatternStore () |
virtual void | attachcorpus (unsigned char *corpusstart, unsigned int corpussize) |
virtual void | attachcorpus (const IndexedCorpus &corpus) |
virtual void | detachcorpus () |
unsigned char * | getcorpus () const |
unsigned int | getcorpussize () const |
virtual void | use_v1_format () |
virtual PatternStoreInterface * | getstoreinterface () |
Public Member Functions inherited from PatternModelInterface | |
virtual PatternStoreInterface * | getstoreinterface () |
virtual PatternStoreInterface * | getstoreinterface () |
Protected Attributes | |
unsigned char | model_type |
unsigned char | model_version |
uint64_t | totaltokens |
uint64_t | totaltypes |
int | maxn |
int | minn |
Protected Attributes inherited from PatternSet< uint64_t > | |
t_patternset | data |
Protected Attributes inherited from PatternStore< t_patternset, uint64_t, Pattern > | |
unsigned char * | corpusstart |
unsigned int | corpussize |
unsigned char | classencodingversion |
int | patterntype |
A pattern model based on an unordered set, does not hold data, only patterns. Very suitable for loading constraint models.
typedef PatternSet<uint64_t>::const_iterator PatternSetModel::const_iterator |
typedef PatternSet<uint64_t>::iterator PatternSetModel::iterator |
|
inline |
Empty constructor
|
inline |
Load a PatternSetModel from stream
options | The options for loading |
constrainmodel | Load only patterns that occur in this model |
|
inline |
Load a PatternSetModel from file
filename | The name of the file to load |
options | The options for loading |
constrainmodel | Load only patterns that occur in this model |
|
inlinevirtual |
This function does not perform anything in a set context, it always returns zero
Implements PatternModelInterface.
|
inline |
Get the interface (just a basic typecast)
|
inlinevirtual |
|
inlinevirtual |
Get the version number of the model
Implements PatternModelInterface.
|
inlinevirtual |
Does the pattern occur in the pattern store?
Implements PatternStoreInterface.
|
inlinevirtual |
Does the pattern occur in the pattern store?
Implements PatternStoreInterface.
|
inlinevirtual |
Load a PatternSetModel from file
filename | The name of the file to load |
options | The options for loading |
constrainmodel | Load only patterns that occur in this model |
|
inlinevirtual |
Load a PatternSetModel from stream
options | The options for loading |
constrainmodel | Load only patterns that occur in this model |
|
inlinevirtual |
Return the maximum length of patterns in this model
Implements PatternModelInterface.
|
inlinevirtual |
Return the minimum length of patterns in this model
Implements PatternModelInterface.
|
inlinevirtual |
This function does not perform anything in a set context, it always returns zero
Implements PatternModelInterface.
|
inlinevirtual |
How many patterns are in the pattern store?
Implements PatternStoreInterface.
|
inlinevirtual |
Returns the total amount of tokens in the original corpus, includes tokens not covered by the model!
Implements PatternModelInterface.
|
inline |
Returns the type of the model, value is of the PatternType enumeration.
|
inlinevirtual |
Returns the total amount of unigram/word types in the original corpus, includes types not covered by the model!
Implements PatternModelInterface.
|
inline |
Returns the version of the model's implementation and binary serialisation format.
|
inlinevirtual |
Write a PatternSetModel to an output stream
Implements PatternStore< t_patternset, uint64_t, Pattern >.
|
inline |
Write a PatternSetModel to an output file. This is a wrapper around write(std::ostream *)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |