72 for (
unsigned int k = 0; k < rd.size(); k++ ) {
91 return sentence.size();
98 void storeRules ( unordered_map<uint, std::vector<uint> >& c ) {
99 for (
unsigned int cc = 1; cc <=
nnt; cc++ ) {
100 for (
unsigned int x = 0; x < sentence.size(); x++ ) {
101 for (
unsigned int y = 0; y < sentence.size() - x; y++ ) {
102 for (
unsigned int k = 0; k <
cykgrid ( cc, x, y ).
size(); ++k )
103 c[cc * 1000000 + y * 1000 + x].push_back ( cykgrid ( cc, x, y, k ) );
115 for (
unsigned int cc = 1; cc <=
nnt; cc++ ) {
116 for (
unsigned int x = 0; x < sentence.size(); x++ ) {
117 for (
unsigned int y = 0; y < sentence.size() - x; y++ ) {
118 if ( cykgrid ( cc, x, y ).
size() )
119 c[cc * 1000000 + y * 1000 + x] = cykgrid ( cc, x, y ).
size();
void reset()
Clear cyk grid.
Data structure containing all cyk-related information.
grammar_inversecategories_t vcat
Inverse map (1=S,2=X,...)
unordered_map< uint, std::string > grammar_inversecategories_t
void reset()
Delete cyk backpointers.
uint nnt
number of non-terminals
cykparser_ruledependencies_t rd
coordinate dependencies for each candidate.
Contains functor that provides access to cyk backpointers.
void storeRules(unordered_map< uint, std::vector< uint > > &c)
Stores rules in a simple hash.
grammar_categories_t categories
Map between categories (S=1,X=2,...)
CYKgrid cykgrid
Cyk grid. Each cell of the grid is uniquely defined by three dimensions: [category,x,y].
unordered_set< std::string > nt_exceptions_maxspan
std::vector< cykparser_rulebpcoordinates_t > cykparser_ruledependencies_t
void storeRuleCounts(unordered_map< uint, uint > &c)
Stores rule counts in a simple hash.
std::size_t size()
Return actual size of the cyk grid.
std::basic_string< uint > cykparser_sentence_t
Contains functor for the cyk grid.
cykparser_sentence_t sentence
The sentence we want to parse.
functor that provides cyk backpointers
uint success
Success and how many parse S nodes have been found in the topmost cell. If 0, cyk parser has failed...
uint getNumberWordsSentence()
Returns number of words in the sentence.
unordered_map< std::string, uint > grammar_categories_t
functor that provides cykgrid access methods