The chart parser enriches each sentence object with a parse_tree object, whose leaves have a link to the sentence words.
The API of the parser is:
class chart_parser {
public:
/// Constructor
chart_parser(const std::string&);
/// Get the start symbol of the grammar
std::string get_start_symbol(void) const;
/// analyze given sentence.
void analyze(sentence &) const;
/// analyze given sentences.
void analyze(std::list<sentence> &) const;
/// return analyzed copy of given sentence
sentence analyze(const sentence &) const;
/// return analyzed copy of given sentences
std::list<sentence> analyze(const std::list<sentence> &) const;
};
The constructor receives a file with the CFG grammar to be used by the grammar, which is described in the next section
The method get_start_symbol returns the initial symbol of the grammar, and is needed by the dependency parser (see below).