#include <ngram.h>
Inherits ace::NGram.
Public Member Functions | |
| void | add_to_context (const PartOfContext &part_of_context) |
| Adds given part_of_context to N-gram context. | |
| context_t * | context (void) |
| const context_t * | context (void) const |
Static Public Member Functions | |
| static void | init (void) |
| Initialize all static members which depends on value of N. | |
Protected Member Functions | |
| ContextedNGram (const raw_ngram_t &raw_ngram, ngram_type_t ngram_type) | |
| Raw ContextedNGram constructor. | |
| ContextedNGram (const NGram &source) | |
| "Parent-copy" constructor is allowed. | |
| ContextedNGram (const NGram &source, ngram_type_t ngram_type) | |
| "Down-cast" copy-constructor. | |
Static Protected Member Functions | |
| static NGram * | c (const raw_ngram_t &raw_ngram, ngram_type_t ngram_type, void *mem) |
| Implementation of ContextedNGram construction function. | |
| static NGram * | cc (const NGram *ngram, void *mem) |
| Implementation of ContextedNGram copy construction function. | |
| static NGram * | dc (const NGram *ngram, ngram_type_t ngram_type, void *mem) |
| Implementation of ContextedNGram downcast construction function. | |
Private Member Functions | |
| ContextedNGram (void) | |
| No default constructs. | |
| ContextedNGram (const ContextedNGram &rhs) | |
| No copy constructs. | |
Although this is the perfect case for use of virtualization, we do not. Use of virtualization requires additional pointer (and bytes to hold its value) to virtual methods table. We cannot afford space for this pointer, so we use static initialization and function pointers to determine, which types of N-grams are already created: NGram or ContextedNGram instances. Note, that all N-grams within single program run either have context or are context-free. The only exception is the zero typed N-gram, which is always context-free.
Definition at line 327 of file ngram.h.
| ace::ContextedNGram::ContextedNGram | ( | void | ) | [inline, private] |
| ace::ContextedNGram::ContextedNGram | ( | const raw_ngram_t & | raw_ngram, | |
| ngram_type_t | ngram_type | |||
| ) | [protected] |
Raw ContextedNGram constructor.
Calls parent raw NGram constructor and creates empty context store.
| raw_ngram | Source raw N-gram. | |
| ngram_type | Type of N-gram to be created (determines which members of `raw_ngram` are copied). |
| ace::ContextedNGram::ContextedNGram | ( | const NGram & | source | ) | [protected] |
"Parent-copy" constructor is allowed.
Constructor calls its parent version and creates empty context store. Context copying is useless (the copy of ContextedNGram, which is stored within N-grams store, is enough for all purposes).
| source | NGram to be copied. |
| ace::ContextedNGram::ContextedNGram | ( | const NGram & | source, | |
| ngram_type_t | ngram_type | |||
| ) | [protected] |
"Down-cast" copy-constructor.
Constructor calls its parent version and creates empty context store. As already mention elsewhere, context copying is useless.
| source | N-gram (full type) which should be downcasted. | |
| ngram_type | Type of N-gram to be created (determines which members of `source` are copied). |
| static NGram* ace::ContextedNGram::c | ( | const raw_ngram_t & | raw_ngram, | |
| ngram_type_t | ngram_type, | |||
| void * | mem | |||
| ) | [inline, static, protected] |
Implementation of ContextedNGram construction function.
| mem | Memory, where to create new instance (must be big enough!) See ContextedNGram(const raw_ngram_t&, ngram_type_t) constructor for other params meaning. |
Reimplemented from ace::NGram.
| static NGram* ace::ContextedNGram::cc | ( | const NGram * | ngram, | |
| void * | mem | |||
| ) | [inline, static, protected] |
Implementation of ContextedNGram copy construction function.
Overrides the parent version.
| mem | Memory, where to create new instance (must be big enough!) See ContextedNGram(const NGram&) constructor for other params meaning. |
Reimplemented from ace::NGram.
| static NGram* ace::ContextedNGram::dc | ( | const NGram * | ngram, | |
| ngram_type_t | ngram_type, | |||
| void * | mem | |||
| ) | [inline, static, protected] |
Implementation of ContextedNGram downcast construction function.
Overrides the parent version.
| mem | Memory, where to create new instance (must be big enough!) See ContextedNGram(const NGram&, ngram_type_t) constructor for other params meaning. |
Reimplemented from ace::NGram.
| void ace::ContextedNGram::init | ( | void | ) | [static] |
Initialize all static members which depends on value of N.
Must be called before any ContextedNGram instance is created!
Reimplemented from ace::NGram.
| void ace::ContextedNGram::add_to_context | ( | const PartOfContext & | part_of_context | ) |
| context_t* ace::ContextedNGram::context | ( | void | ) | [inline] |
| const context_t* ace::ContextedNGram::context | ( | void | ) | const [inline] |
1.5.6