Used for computing the x-bar parse forest from a epic.parser.ParseMarginal.
Creates a locally-normalized anchored PCFG from some refined forest.
Creates anchorings for a set of trees from some parser using p(rule | sentence) marginals.
Creates anchorings for a set of trees from some parser using p(rule | sentence) marginals.
Used for computed the expected number of anchored labels that occur at each span
Used for computed the expected number of anchored labels that occur at each span
Projects a chart to a span anchoring
An epic.parser.projections.EnumeratedAnchoring is a compressed forest, with potentially distinct rule and span scores for every possible anchoring into the sentence.
An epic.parser.projections.EnumeratedAnchoring is a compressed forest, with potentially distinct rule and span scores for every possible anchoring into the sentence. Commonly produced by either an epic.parser.projections.AnchoredPCFGProjector (for PCFG forests) or an epic.parser.projections.AnchoredRuleMarginalProjector (for rule marginal forests).
GoldTagPolicys are used in places where sometimes (mostly for debugging) we'd like to know which labeled spans are "gold" (correct) and which are not.
Handles the mapping between a coarser grammar and a finer grammar.
Handles the mapping between a coarser grammar and a finer grammar. (For example, an xbar grammar and an xbar grammar with latent variables.) It mostly just aggregates two epic.projections.ProjectionIndexers, one for labels and one for rules. It also provides convenience methods for, e.g., getting all rule refinements that have a given parent refinment.
Refined symbols and rules are given a "local" integer index that is specific to a coarse symbol. For example, NP-4 might have "global index" 37 for all symbols, but will have NP-specific local index 4. Analogously, NP-4 -> NP-3 PP-2 will have a NP -> NP PP specific local index.
Creates a grammar using only span marginals and unary rule marginals
Finds the best tree (relative to the gold tree) s.t.
Finds the best tree (relative to the gold tree) s.t. it's reacheable given the current anchoring. Best is measured as number of correct labeled spans, as usual. If the given treebank symbol is correct, bonus points can be awarded for getting the right refinement.
On the training set, the "best" reachable tree will not always (~5% of the time) be the correct tree, because pruning will remove the right answer. We don't want to try to train towards an unreachable tree, because the training algorithm will do bad things. Instead, we want the best possible tree that our parser could conceivably produce. That is why this class exists.
If backupGrammar is provided, it will be used to find such a tree in the case that no tree can be found with grammar (given the current constraints).
Typically, the first grammar will be a treebank grammar that has no horizontal markovization (i.e. it is not forgetfully binarized) and it also remembers the functional tags like -TMP. The backup grammar is usually the grammar with which the pruning masks were produced; because of the way we prune, that parser will always be able to find a tree (assuming that it was able to find a tree without pruning.)
TODO: should be a cascade of grammars
Creates labeled span scorers for a set of trees from some parser.
Creates labeled span scorers for a set of trees from some parser.
For computing projections from a fine grammar to a coarse grammar.
For computing projections from a fine grammar to a coarse grammar.
There are two indexes maintained for the fine symbols: a globally unique id, and a local per-symbol id (in the range 0...numRefinements(coarseSym).
Yuck.
A SpanAnchoring just scores spans and unary rules.
A SpanAnchoring just scores spans and unary rules. BinaryRules are all given score 0.0
Object for creating epic.constraints.CachedChartConstraintsFactory from a parser and prepopulating it with the contents of a treebank.
Used for computing the x-bar parse forest from a epic.parser.ParseMarginal.