|
| SKGrammar () |
|
| Grammar () |
|
| Grammar (const Grammar &g)=delete |
|
| Grammar (const Grammar &&g)=delete |
|
RuleIterator | begin () const |
|
RuleIterator | end () const |
|
constexpr nonterminal_t | start () |
| The start nonterminal type. More...
|
|
constexpr size_t | count_nonterminals () const |
|
size_t | count_nonterminals (nonterminal_t nt) const |
|
size_t | count_rules (const nonterminal_t nt) const |
|
size_t | count_rules () const |
|
void | change_probability (const std::string &s, const double newp) |
|
size_t | count_terminals (nonterminal_t nt) const |
|
void | add_vms (std::string fmt, FT *f, double p=1.0, Op o=Op::Standard, int a=0) |
|
void | add (std::string fmt, Primitive< T, args... > &b, double p=1.0, int a=0) |
|
void | add (std::string fmt, std::function< T(args...)> f, double p=1.0, Op o=Op::Standard, int a=0) |
|
void | add (std::string fmt, T(*_f)(args...), double p=1.0, Op o=Op::Standard, int a=0) |
| Wrapper for add to use function pointers. More...
|
|
void | add_terminal (std::string fmt, T x, double p=1.0, Op o=Op::Standard, int a=0) |
| Add a variable that is NOT A function – simplification for adding alphabets etc. This just wraps stuff in a thunk for us to make it easier. NOTE: x is copied by value. More...
|
|
void | add_ft (std::string fmt, T(*_f)(args...), double p=1.0, Op o=Op::Standard, int a=0) |
| Adds this as a function type (see Function.h) rather than as a function itself. For example, if we add_ft the function F =[](int,char)->bool{...}, then we will be adding the expansion in the grammar, ft<bool,int,char> -> F. Note in this case, there are no s in fmt because in the grammar, this takes no arguments (we need an "apply" to use it). Very confusing. More...
|
|
void | remove_all (nonterminal_t nt) |
| Remove all the nonterminals of this type from the grammar. NOTE: This is generally a really bad idea unless you know what you are doing. More...
|
|
size_t | get_index_of (const Rule *r) const |
|
virtual Rule * | get_rule (const nonterminal_t nt, size_t k) const |
|
virtual Rule * | get_rule (const nonterminal_t nt, const Op o, const int a=0) |
|
virtual Rule * | get_rule (const nonterminal_t nt, size_t i) |
|
virtual Rule * | get_rule (const nonterminal_t nt, const std::string s) const |
|
virtual Rule * | get_rule (const std::string s) const |
|
double | rule_normalizer (const nonterminal_t nt) const |
|
virtual Rule * | sample_rule (const nonterminal_t nt) const |
|
Node | makeNode (const Rule *r) const |
|
Node | __generate (const nonterminal_t ntfrom=nt< output_t >(), unsigned long depth=0) const |
|
Node | generate (const nonterminal_t ntfrom=nt< output_t >(), unsigned long depth=0) const |
| A wrapper to catch DepthExcpetions and retry. This means that defaultly we try to generate GENERATE_DEPTH_EXCEPTION_RETRIES times and if ALL of them fail, we throw an assert error. Presumably, unless the grammar is terrible one of them will work. This makes our DepthExceptions generally silent to the outside since they won't call __generate typically. More...
|
|
Node | copy_resample (const Node &node, bool f(const Node &n)) const |
|
const std::map< const Rule *, size_t > | get_rule_indexer () const |
| Returns a map from rule pointers to indices in e.g. a vector, so that every rule has a unique index and the rules are sorted by nt type. This is what we should use whenever we need a fixed order. More...
|
|
std::vector< size_t > | get_counts (const Node &node) const |
| Compute a vector of counts of how often each rule was used, in a standard order given by iterating over nts and then iterating over rules. More...
|
|
std::vector< size_t > | get_counts (const Node &node, const std::map< const Rule *, size_t > &indexer) const |
| Compute a vector of counts of how often each rule was used, using indexer to map each rule to an index. More...
|
|
std::vector< size_t > | get_counts (const std::map< K, V > &m, const std::map< const Rule *, size_t > &indexer) const |
| Support for map so we can call on Lexicon::get_value. More...
|
|
double | log_probability (const Node &n) const |
| This computes the expected length of productions from this grammar, counting terminals and nonterminals as 1 each NOTE: We can do this smarter with a matrix eigenvalues, but its a bit less flexible/extensible. More...
|
|
Node | from_parseable (std::deque< std::string > &q) const |
|
Node | from_parseable (std::string s) const |
|
Node | from_parseable (const char *c) const |
|
size_t | neighbors (const Node &node) const |
|
void | expand_to_neighbor (Node &node, int &which) |
|
double | neighbor_prior (const Node &node, int &which) const |
|
void | complete (Node &node) |
|
std::tuple< int, std::vector< int >, int > | find_open_commas_close (const std::string s) |
|
Node | simple_parse (std::string s) |
| Very simple parsing routine that takes a string like "and(not(or(eq_pos(pos(parent(x)),'NP-POSS'),eq_pos('NP-S',pos(x)))),corefers(x))" (from the Binding example) and parses it into a Node. More...
|
|