public class SGraphBRDecompositionAutomatonBottomUp extends TreeAutomaton<BoundaryRepresentation>
BoundaryRepresentation
s as states.TreeAutomaton.BottomUpStateVisitor
D, DEBUG_STORE
Constructor and Description |
---|
SGraphBRDecompositionAutomatonBottomUp(SGraph completeGraph,
GraphAlgebra algebra)
Initializes a decomposition automaton for
completeGraph with respect to algebra . |
Modifier and Type | Method and Description |
---|---|
Iterable<Rule> |
getRulesBottomUp(int labelId,
int[] childStates)
Finds automaton rules bottom-up for a given list of child states and a
given parent label.
|
Iterable<Rule> |
getRulesTopDown(int labelId,
int parentState)
Finds automaton rules top-down for a given parent state and label.
|
boolean |
isBottomUpDeterministic()
Determines whether the automaton is deterministic if read as a bottom-up
automaton.
|
static void |
main(String[] args)
Writes the decomposition automata for a given corpus.
|
SiblingFinder |
newSiblingFinder(int labelID)
This returns an object that stores and finds possible partners for a
given state given a rule label.
|
boolean |
supportsBottomUpQueries() |
boolean |
supportsTopDownQueries() |
String |
toString()
Computes a string representation of this automaton.
|
boolean |
useSiblingFinder()
Algorithms such as invhom check this function to decide whether their
sibling finder variant should be used or not.
|
boolean |
writeAutomatonRestricted(Writer writer)
Writes all rules in this decomposition automaton, with one restriction:
There are no rename operations on states only reachable via rename.
|
static void |
writeDecompositionAutomata(String targetFolderPath,
Corpus corpus,
int startIndex,
int stopIndex,
int sourceCount,
int maxNodes,
int maxPerNodeCount,
boolean onlyBolinas)
Writes the decomposition automata for all specified graphs in the corpus,
with one restriction: There are no rename operations on states only
reachable via rename.
|
accepts, acceptsRaw, analyze, asConcreteTreeAutomaton, asConcreteTreeAutomatonBottomUp, asConcreteTreeAutomatonWithStringStates, countTrees, createRule, createRule, createRule, createRule, createRule, createRule, determinize, determinize, dumpToFile, equals, evaluateInSemiring, evaluateInSemiring, evaluateInSemiringTopDown, foreachRuleBottomUpForSets, foreachRuleTopDown, foreachStateInBottomUpOrder, getAllLabels, getAllRulesTopDown, getAllStates, getFinalStates, getIdForState, getLabelsTopDown, getNumberOfRules, getNumberOfSeenStates, getRandomRuleTree, getRandomRuleTreeFromInside, getRandomTree, getRandomTreeFromInside, getReachableStates, getRulesBottomUp, getRulesBottomUp, getRuleSet, getRulesForRhsState, getRulesTopDown, getRuleTree, getSignature, getStateForId, getStateInterner, getStatesInBottomUpOrder, getStoredConstantsForID, getWeight, getWeightRaw, hasRuleWithPrefix, hasStoredConstants, homomorphism, inside, intersect, intersect, intersectBottomUp, intersectCondensed, intersectCondensed, intersectCondensed, intersectCondensedBottomUp, intersectCondensedBottomUp, intersectEarley, intersectViterbi, intersectViterbi, inverseCondensedHomomorphism, inverseHomomorphism, isCyclic, isEmpty, isStoring, language, languageIterable, languageIterator, languageIteratorRaw, languageRaw, makeAllRulesExplicit, normalizeRuleWeights, outside, processAllRulesBottomUp, processAllRulesTopDown, reduceTopDown, run, run, runRaw, setRulePrintingFilter, setSkipFail, setStoring, sortedLanguageIterator, toStringBottomUp, viterbi, viterbiRaw, write
public SGraphBRDecompositionAutomatonBottomUp(SGraph completeGraph, GraphAlgebra algebra)
completeGraph
with respect to algebra
.completeGraph
- algebra
- public Iterable<Rule> getRulesBottomUp(int labelId, int[] childStates)
TreeAutomaton
getRulesBottomUp
in class TreeAutomaton<BoundaryRepresentation>
public boolean isBottomUpDeterministic()
TreeAutomaton
isBottomUpDeterministic
in class TreeAutomaton<BoundaryRepresentation>
public boolean supportsTopDownQueries()
supportsTopDownQueries
in class TreeAutomaton<BoundaryRepresentation>
public boolean supportsBottomUpQueries()
supportsBottomUpQueries
in class TreeAutomaton<BoundaryRepresentation>
public Iterable<Rule> getRulesTopDown(int labelId, int parentState)
TreeAutomaton
Note that not every method of TreeAutomaton is safely available in your
implementation of getRulesTopDown. Most notably, you can't use the
default implementation of TreeAutomaton.getAllStates()
, because that method
makes all rules of the automaton explicit and calls TreeAutomaton.getRulesTopDown(int, int)
in the process, leading to an infinite recursion.
getRulesTopDown
in class TreeAutomaton<BoundaryRepresentation>
public SiblingFinder newSiblingFinder(int labelID)
TreeAutomaton
newSiblingFinder
in class TreeAutomaton<BoundaryRepresentation>
public boolean useSiblingFinder()
TreeAutomaton
useSiblingFinder
in class TreeAutomaton<BoundaryRepresentation>
public boolean writeAutomatonRestricted(Writer writer) throws Exception
writer
- Exception
public String toString()
TreeAutomaton
toString
in class TreeAutomaton<BoundaryRepresentation>
public static void writeDecompositionAutomata(String targetFolderPath, Corpus corpus, int startIndex, int stopIndex, int sourceCount, int maxNodes, int maxPerNodeCount, boolean onlyBolinas) throws Exception
targetFolderPath
- The folder into which the automata are written.corpus
- The corpus to parse. The graph interpretation must be
labeled "graph".startIndex
- At which index to start (graphs are ordered by node count)stopIndex
- At which index to stop (graphs are ordered by node count)sourceCount
- How many sources to use in decomposition.maxNodes
- A hard cap on the number of nodes allowed per graph
(violating graphs are not parsed). 0 for no restriction.maxPerNodeCount
- If for a node count n this is less then the number
of graphs with n nodes, then maxPerNodeCount
many are chosen
randomly.onlyBolinas
- Whether only graphs expressible in the Bolinas format
should be examined.Exception
public static void main(String[] args) throws Exception
writeDecompositionAutomata
with the given arguments.
Call without arguments to receive help.
Takes eight arguments:
1. The path to the the corpus. It should have "graph" and "string"
interpretations.
2. How many sources to use in decomposition.
3. At which index to start (inclusive, graphs are ordered by node count)
4. At which index to stop (exclusive, graphs are ordered by node count)
Here indices are 0-based.
5. A hard cap on the number of nodes allowed per graph
(violating graphs are not parsed). 0 for no restriction.
6. A parameter k. If for a node count n, k is less then the number
of graphs with n nodes, then k are chosen randomly.
7. targetFolderPath: The folder into which the automata are written.
8. 'onlyBolinas' or 'all', depending on whether only graphs expressible
in the Bolinas format should be examined.args
- Exception
Copyright © 2017. All rights reserved.