Colibri Core
Classes | Typedefs | Enumerations | Functions
patternmodel.h File Reference

Contains classes for Pattern Models. More...

#include "patternstore.h"
#include "classencoder.h"
#include "algorithms.h"
#include <limits>
#include <cmath>
#include <cstdint>
#include <map>
#include <set>
#include <sstream>
#include <array>
#include <exception>
#include "bz2stream.h"

Go to the source code of this file.

Classes

class  NoSuchPattern
 
class  PatternModelOptions
 Options for Pattern Model loading and training. More...
 
class  PatternModelInterface
 Basic read-only interface for pattern models, abstract base class. More...
 
class  PatternSetModel
 A pattern model based on an unordered set, does not hold data, only patterns. Very suitable for loading constraint models. More...
 
class  PatternModel< ValueType, ValueHandler, MapType, PatternType >
 A model mapping patterns to values, gigh-level interface. More...
 
class  IndexedPatternModel< MapType, PatternType >
 An indexed model mapping patterns to values, high-level interface. This is a specialised subclass of PatternMap. More...
 
class  PatternPointerModel< ValueType, ValueHandler, MapType >
 
class  IndexedPatternPointerModel< MapType >
 

Typedefs

typedef PatternMap< uint32_t, BaseValueHandler< uint32_t >, uint64_t > t_relationmap
 
typedef PatternMap< double, BaseValueHandler< double >, uint64_t > t_relationmap_double
 
typedef PatternMap< uint32_t, BaseValueHandler< uint32_t >, uint64_t >::iterator t_relationmap_iterator
 
typedef PatternMap< double, BaseValueHandler< double >, uint64_t >::iterator t_relationmap_double_iterator
 

Enumerations

enum  ModelType {
  UNINDEXEDPATTERNMODEL = 10, UNINDEXEDPATTERNPOINTERMODEL = 11, INDEXEDPATTERNMODEL = 20, INDEXEDPATTERNPOINTERMODEL = 21,
  PATTERNSETMODEL = 30, PATTERNALIGNMENTMODEL = 40
}
 
enum  ReverseIndexType { NONE = 0, QUICK = 1, COMPACT = 2 }
 

Functions

int getmodeltype (const std::string &filename)
 
double comparemodels_loglikelihood (const Pattern pattern, std::vector< PatternModel< uint32_t > * > &models)
 
void comparemodels_loglikelihood (std::vector< PatternModel< uint32_t > * > &models, PatternMap< double > *resultmap, bool conjunctiononly=false, std::ostream *output=NULL, ClassDecoder *classdecoder=NULL)
 

Detailed Description

Contains classes for Pattern Models.

Author
Maarten van Gompel (proycon) proyc.nosp@m.on@a.nosp@m.napro.nosp@m.y.nl

LICENSE

Licensed under GPLv3

DESCRIPTION

Contains classes for Pattern Models

Typedef Documentation

typedef PatternMap<uint32_t,BaseValueHandler<uint32_t>,uint64_t> t_relationmap

A relationmap is just a pattern map, the map is specific for a pattern and holds patterns that are in a relation with the first pattern. The value of the map is an integer that expresses how often the relationship occurs.

typedef PatternMap<double,BaseValueHandler<double>,uint64_t> t_relationmap_double

A relationmap_double is just a pattern map, the map is specific for a pattern and holds patterns that are in a relation with the first pattern. The value of the map is an double that expresses the weight of the relation.

typedef PatternMap<double,BaseValueHandler<double>,uint64_t>::iterator t_relationmap_double_iterator
typedef PatternMap<uint32_t,BaseValueHandler<uint32_t>,uint64_t>::iterator t_relationmap_iterator

Enumeration Type Documentation

enum ModelType

Defines the various types of pattern models

Enumerator
UNINDEXEDPATTERNMODEL 
UNINDEXEDPATTERNPOINTERMODEL 
INDEXEDPATTERNMODEL 
INDEXEDPATTERNPOINTERMODEL 
PATTERNSETMODEL 
PATTERNALIGNMENTMODEL 

Defines Reverse Index Types

Enumerator
NONE 
QUICK 
COMPACT 

Function Documentation

double comparemodels_loglikelihood ( const Pattern  pattern,
std::vector< PatternModel< uint32_t > * > &  models 
)

Computation of log likelihood for a single pattern, accross corpora.

Computation is as in Rayson and Garside (2000), Comparing corpora using frequency profiling. In proceedings of the workshop on Comparing Corpora, held in conjunction with the 38th annual meeting of the Association for Computational Linguistics (ACL 2000). 1-8 October 2000, Hong Kong, pp. 1 - 6: http://www.comp.lancs.ac.uk/~paul/publications/rg_acl2000.pdf

void comparemodels_loglikelihood ( std::vector< PatternModel< uint32_t > * > &  models,
PatternMap< double > *  resultmap,
bool  conjunctiononly,
std::ostream *  output,
ClassDecoder classdecoder 
)

Computation of log likelihood between patterns in corpora

Computation is as in Rayson and Garside (2000), Comparing corpora using frequency profiling. In proceedings of the workshop on Comparing Corpora, held in conjunction with the 38th annual meeting of the Association for Computational Linguistics (ACL 2000). 1-8 October 2000, Hong Kong, pp. 1 - 6: http://www.comp.lancs.ac.uk/~paul/publications/rg_acl2000.pdf

int getmodeltype ( const std::string &  filename)

Extracts the model type (one of ModelType) from a file