# ace::Parser Class Reference

Parser object binds itself to open ifstream object, which corresponds to certain input datafile. More...

`#include <parser.h>`

List of all members.

## Public Types
typedef std::vector< size_t > | parsed_counter_t
| Container holds numbers of words in each sentence (recently) parsed.
## Public Member Functions
| Parser (std::ifstream &input_file)
| Constructor attach Parser to given input file ifstream object.
bool | eof (void) const
const parsed_counter_t & | parsed (void) const
bool | next (size_t count, ContextWindow::Mode mode, words_store_t &store)
| Parse and push next sentence(s).
## Private Attributes
std::ifstream & | _input_file
| Reference to file to be parsed.
size_t | _line_no
| Line numbers counter.
parsed_counter_t | _parsed_counter
| Parsed words and sentences counter (its value changes by every call to next(size_t, ContextWindow::Mode, words_store_t&).

## Detailed Description

Parser object binds itself to open ifstream object, which corresponds to certain input datafile.

Then parses the file by steps, which are determined by calls to next(size_t, ContextWindow::Mode, words_store_t&) method.

## Member Typedef Documentation

typedef std::vector<size_t> ace::Parser::parsed_counter_t

Container holds numbers of words in each sentence (recently) parsed.

## Constructor & Destructor Documentation

ace::Parser::Parser | ( | std::ifstream & | input_file | ) | `[inline]`

Constructor attach Parser to given input file ifstream object.

Parameters:

  | input_file | Reference to (already open!) file to be parsed.

## Member Function Documentation

bool ace::Parser::eof | ( | void |  | ) | const`[inline]`

Returns:
  True, if internal parser pointer reached the end of file.

const parsed_counter_t& ace::Parser::parsed | ( | void |  | ) | const`[inline]`

Returns:
  Reference to const instance of recently parsed sentences counter.

bool ace::Parser::next | ( | size_t | count,
|  | ContextWindow::Mode | mode,
|  | words_store_t & | store |
| ) |  |  |

Parse and push next sentence(s).

The number of sentences parsed depends on count and mode params and on the current position of filestream pointer (no parsing may be performed behind the end of file:).

Parameters:

  | count | Number of units to parse (unit type is determined by `mode`).
  | mode | One of ContextWindow::Mode values.
  | store | Reference to container to push parsed words in.

Returns:
  True, if any sentence has been parsed.

## Member Data Documentation

std::ifstream& ace::Parser::_input_file`[private]`

Reference to file to be parsed.

size_t ace::Parser::_line_no`[private]`

Line numbers counter.

parsed_counter_t ace::Parser::_parsed_counter`[private]`

Parsed words and sentences counter (its value changes by every call to next(size_t, ContextWindow::Mode, words_store_t&).

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

- proto/Source/parser.h
- proto/Source/parser.cpp