NgramCounts Class Reference

#include <Ngram.h>

List of all members.

Classes

struct  NgramComparator

Public Types

typedef std::vector< int > Key
typedef int Value
typedef std::map< Key, Value,
NgramComparator >::iterator 
iterator
typedef std::map< Key, Value,
NgramComparator >
::const_iterator 
const_iterator

Public Member Functions

 NgramCounts ()
virtual ~NgramCounts ()
void Add (const Key &ngram)
bool Lookup (const Key &ngram, Value *v) const
void clear ()
bool empty () const
std::size_t size () const
std::size_t max_size () const
int get_default_count () const
iterator find (const Key &ngram)
const_iterator find (const Key &ngram) const
Valueoperator[] (const Key &ngram)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const


Detailed Description

A simple STL-stdmap based n-gram counts. Basically, we provide typical accessors and mutaors, but we intentionally does not allow erasing elements.

Definition at line 12 of file Ngram.h.


Member Typedef Documentation

Definition at line 36 of file Ngram.h.

Definition at line 35 of file Ngram.h.

typedef std::vector<int> NgramCounts::Key

Definition at line 33 of file Ngram.h.

typedef int NgramCounts::Value

Definition at line 34 of file Ngram.h.


Constructor & Destructor Documentation

NgramCounts::NgramCounts (  )  [inline]

Definition at line 38 of file Ngram.h.

virtual NgramCounts::~NgramCounts (  )  [inline, virtual]

Definition at line 39 of file Ngram.h.


Member Function Documentation

void NgramCounts::Add ( const Key ngram  )  [inline]

If the specified "ngram" is found, we add counts. If not, we insert the default count in the container.

Definition at line 44 of file Ngram.h.

References end(), and find().

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

Here is the caller graph for this function:

const_iterator NgramCounts::begin (  )  const [inline]

Definition at line 89 of file Ngram.h.

iterator NgramCounts::begin (  )  [inline]

Definition at line 88 of file Ngram.h.

void NgramCounts::clear (  )  [inline]

Clear all elments in the container.

Definition at line 66 of file Ngram.h.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

bool NgramCounts::empty (  )  const [inline]

Return true iff the container is empty.

Definition at line 71 of file Ngram.h.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

const_iterator NgramCounts::end (  )  const [inline]

Definition at line 91 of file Ngram.h.

iterator NgramCounts::end (  )  [inline]

Definition at line 90 of file Ngram.h.

Referenced by Add(), and BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

const_iterator NgramCounts::find ( const Key ngram  )  const [inline]

Definition at line 84 of file Ngram.h.

iterator NgramCounts::find ( const Key ngram  )  [inline]

Definition at line 83 of file Ngram.h.

Referenced by Add(), and BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

int NgramCounts::get_default_count (  )  const [inline]

Definition at line 81 of file Ngram.h.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

bool NgramCounts::Lookup ( const Key ngram,
Value v 
) const [inline]

Return true iff the specified "ngram" is found in the container.

Definition at line 56 of file Ngram.h.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

std::size_t NgramCounts::max_size (  )  const [inline]

Definition at line 78 of file Ngram.h.

Value& NgramCounts::operator[] ( const Key ngram  )  [inline]

Definition at line 86 of file Ngram.h.

std::size_t NgramCounts::size (  )  const [inline]

Return the the number of elements in the container.

Definition at line 76 of file Ngram.h.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:


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

Generated on Sat Jun 30 00:30:12 2012 for Moses by  doxygen 1.5.9