Class for storage & retrieval of raw N-Gram frequencies.
|
| mootNgrams (void) |
|
| ~mootNgrams () |
|
void | clear (void) |
|
size_t | n_unigrams (void) const |
|
size_t | n_bigrams (void) const |
|
size_t | n_trigrams (void) const |
|
void | add_count (const mootTagString &tag, const NgramCount count) |
|
void | add_count (const mootTagString &tag1, const mootTagString &tag2, const NgramCount count) |
|
void | add_count (const mootTagString &tag1, const mootTagString &tag2, const mootTagString &tag3, const NgramCount count) |
|
void | add_count (const Ngram &ngram, const NgramCount count) |
|
void | add_counts (const Ngram &ngram, const NgramCount count) |
|
const NgramCount | lookup (const mootTagString &tag) const |
|
const NgramCount | lookup (const mootTagString &tag1, const mootTagString &tag2) const |
|
const NgramCount | lookup (const mootTagString &tag1, const mootTagString &tag2, const mootTagString &tag3) const |
|
bool | load (const char *filename) |
|
bool | load (FILE *file, const char *filename=__null) |
|
bool | save (const char *filename, bool compact=false) |
|
bool | save (FILE *file, const char *filename=__null, bool compact=false) |
|
◆ NgramCount
◆ TrigramTable
Type for tertiary (tag->trigramCount) lookup-table entry
◆ BigramTable
Type for secondary lookup table
◆ NgramTable
Type for primary lookup-table
◆ mootNgrams()
moot::mootNgrams::mootNgrams |
( |
void |
| ) |
|
|
inline |
◆ ~mootNgrams()
moot::mootNgrams::~mootNgrams |
( |
| ) |
|
|
inline |
Default destructor
References clear().
◆ clear()
void moot::mootNgrams::clear |
( |
void |
| ) |
|
|
inline |
◆ n_unigrams()
size_t moot::mootNgrams::n_unigrams |
( |
void |
| ) |
const |
|
inline |
◆ n_bigrams()
size_t moot::mootNgrams::n_bigrams |
( |
void |
| ) |
const |
Return the number of distinct stored bigrams
Referenced by n_unigrams().
◆ n_trigrams()
size_t moot::mootNgrams::n_trigrams |
( |
void |
| ) |
const |
Return the number of distinct stored trigrams
Referenced by n_unigrams().
◆ add_count() [1/4]
◆ add_count() [2/4]
◆ add_count() [3/4]
◆ add_count() [4/4]
void moot::mootNgrams::add_count |
( |
const Ngram & |
ngram, |
|
|
const NgramCount |
count |
|
) |
| |
|
inline |
◆ add_counts()
void moot::mootNgrams::add_counts |
( |
const Ngram & |
ngram, |
|
|
const NgramCount |
count |
|
) |
| |
|
inline |
Add count
to the current count for <tag1>, <tag1,tag2>, and <tag1,tag2,tag3> in ngram
.... ngram
may be shorter than 3 tags, in which case counts are only added for the elements present.
References moot::mootNgrams::BigramEntry::BigramEntry(), moot::mootNgrams::BigramEntry::count, moot::mootNgrams::Ngram::tag1(), moot::mootNgrams::Ngram::tag2(), and moot::mootNgrams::Ngram::tag3().
◆ lookup() [1/3]
Returns current count for unigram, returns 0 if unknown
◆ lookup() [2/3]
Returns current count for bigram <tag1,tag2>, returns 0 if unknown
◆ lookup() [3/3]
Returns current count for trigram <tag1,tag2,tag3>, returns 0 if unknown
References load(), and save().
◆ load() [1/2]
bool moot::mootNgrams::load |
( |
const char * |
filename | ) |
|
Load n-grams from a TnT-style parameter file
Referenced by lookup().
◆ load() [2/2]
bool moot::mootNgrams::load |
( |
FILE * |
file, |
|
|
const char * |
filename = __null |
|
) |
| |
Load n-grams from a TnT-style parameter file (stream version)
◆ save() [1/2]
bool moot::mootNgrams::save |
( |
const char * |
filename, |
|
|
bool |
compact = false |
|
) |
| |
Save n-grams to a TnT-style paramater file
Referenced by lookup().
◆ save() [2/2]
bool moot::mootNgrams::save |
( |
FILE * |
file, |
|
|
const char * |
filename = __null , |
|
|
bool |
compact = false |
|
) |
| |
Save n-grams to a TnT-style paramater file (stream version)
◆ ngtable
N-Gram to count lookup table
◆ ugtotal
The documentation for this class was generated from the following file: