protected void makeInitialBlocks() { // sink block (for if the automaton isn't complete makeBlock(Collections.singleton(SINK_NODE)); // accepting block Set endNodes = getUnminimizedFA().getEndNodes(); makeBlock(endNodes); // main block Collection nonFinalNodes = new HashSet(getUnminimizedFA().getNodes()); nonFinalNodes.removeAll(endNodes); makeBlock(nonFinalNodes); }
nf.setMinimumFractionDigits(1); StringBuilder result = new StringBuilder(); Set nodes = getNodes(); result.append("digraph G {\n");
public TransducerGraph processGraph(TransducerGraph g) { g = new TransducerGraph(g); Set nodes = g.getNodes(); for (Object node : nodes) { Set<Arc> myArcs = null; if (forward) { myArcs = g.getArcsBySource(node); } else { myArcs = g.getArcsByTarget(node); } // compute a total double total = 0.0; for (Arc a : myArcs) { total += ((Double) a.getOutput()).doubleValue(); } // divide each by total for (Arc a : myArcs) { a.setOutput(new Double(Math.log(((Double) a.getOutput()).doubleValue() / total))); } } return g; } }
TransducerGraph graph = entry.getValue(); if (verbose) { System.out.println("About to compact grammar for " + cat + " with numNodes=" + graph.getNodes().size());
protected void makeInitialBlocks() { // sink block (for if the automaton isn't complete makeBlock(Collections.singleton(SINK_NODE)); // accepting block Set<Arc> endNodes = getUnminimizedFA().getEndNodes(); makeBlock(endNodes); // main block Collection<Arc> nonFinalNodes = Generics.newHashSet(getUnminimizedFA().getNodes()); nonFinalNodes.removeAll(endNodes); makeBlock(nonFinalNodes); }
TransducerGraph combGraph = new TransducerGraph(detGraph, ocp); // combine outputs into inputs System.out.println("Minimized from " + randomFA.getNodes().size() + " to " + result.getNodes().size()); result = new TransducerGraph(result, ntsp); // pull out strings from sets returned by minimizer result = new TransducerGraph(result, isp); // split outputs from inputs
ClassicCounter length = new ClassicCounter(); Map first = new HashMap(); Set nodes = graph.getNodes(); for (Object node : nodes) { lambda.setCount(node, 0);
protected void makeInitialBlocks() { // sink block (for if the automaton isn't complete makeBlock(Collections.singleton(SINK_NODE)); // accepting block Set endNodes = getUnminimizedFA().getEndNodes(); makeBlock(endNodes); // main block Collection nonFinalNodes = new HashSet(getUnminimizedFA().getNodes()); nonFinalNodes.removeAll(endNodes); makeBlock(nonFinalNodes); }
protected void makeInitialBlocks() { // sink block (for if the automaton isn't complete makeBlock(Collections.singleton(SINK_NODE)); // accepting block Set endNodes = getUnminimizedFA().getEndNodes(); makeBlock(endNodes); // main block Collection nonFinalNodes = new HashSet(getUnminimizedFA().getNodes()); nonFinalNodes.removeAll(endNodes); makeBlock(nonFinalNodes); }
protected void makeInitialBlocks() { // sink block (for if the automaton isn't complete makeBlock(Collections.singleton(SINK_NODE)); // accepting block Set endNodes = getUnminimizedFA().getEndNodes(); makeBlock(endNodes); // main block Collection nonFinalNodes = new HashSet(getUnminimizedFA().getNodes()); nonFinalNodes.removeAll(endNodes); makeBlock(nonFinalNodes); }
protected void makeInitialBlocks() { // sink block (for if the automaton isn't complete makeBlock(Collections.singleton(SINK_NODE)); // accepting block Set endNodes = getUnminimizedFA().getEndNodes(); makeBlock(endNodes); // main block Collection nonFinalNodes = new HashSet(getUnminimizedFA().getNodes()); nonFinalNodes.removeAll(endNodes); makeBlock(nonFinalNodes); }
TransducerGraph graph = entry.getValue(); if (verbose) { System.out.println("About to compact grammar for " + cat + " with numNodes=" + graph.getNodes().size());
public TransducerGraph processGraph(TransducerGraph g) { g = new TransducerGraph(g); Set nodes = g.getNodes(); for (Object node : nodes) { Set<Arc> myArcs = null; if (forward) { myArcs = g.getArcsBySource(node); } else { myArcs = g.getArcsByTarget(node); } // compute a total double total = 0.0; for (Arc a : myArcs) { total += ((Double) a.getOutput()).doubleValue(); } // divide each by total for (Arc a : myArcs) { a.setOutput(new Double(Math.log(((Double) a.getOutput()).doubleValue() / total))); } } return g; } }
public TransducerGraph processGraph(TransducerGraph g) { g = new TransducerGraph(g); Set nodes = g.getNodes(); for (Object node : nodes) { Set<Arc> myArcs = null; if (forward) { myArcs = g.getArcsBySource(node); } else { myArcs = g.getArcsByTarget(node); } // compute a total double total = 0.0; for (Arc a : myArcs) { total += ((Double) a.getOutput()).doubleValue(); } // divide each by total for (Arc a : myArcs) { a.setOutput(new Double(Math.log(((Double) a.getOutput()).doubleValue() / total))); } } return g; } }
public TransducerGraph processGraph(TransducerGraph g) { g = new TransducerGraph(g); Set nodes = g.getNodes(); for (Object node : nodes) { Set<Arc> myArcs = null; if (forward) { myArcs = g.getArcsBySource(node); } else { myArcs = g.getArcsByTarget(node); } // compute a total double total = 0.0; for (Arc a : myArcs) { total += ((Double) a.getOutput()).doubleValue(); } // divide each by total for (Arc a : myArcs) { a.setOutput(new Double(Math.log(((Double) a.getOutput()).doubleValue() / total))); } } return g; } }
TransducerGraph graph = entry.getValue(); if (verbose) { System.out.println("About to compact grammar for " + cat + " with numNodes=" + graph.getNodes().size());
TransducerGraph combGraph = new TransducerGraph(detGraph, ocp); // combine outputs into inputs System.out.println("Minimized from " + randomFA.getNodes().size() + " to " + result.getNodes().size()); result = new TransducerGraph(result, ntsp); // pull out strings from sets returned by minimizer result = new TransducerGraph(result, isp); // split outputs from inputs
TransducerGraph combGraph = new TransducerGraph(detGraph, ocp); // combine outputs into inputs System.out.println("Minimized from " + randomFA.getNodes().size() + " to " + result.getNodes().size()); result = new TransducerGraph(result, ntsp); // pull out strings from sets returned by minimizer result = new TransducerGraph(result, isp); // split outputs from inputs
TransducerGraph combGraph = new TransducerGraph(detGraph, ocp); // combine outputs into inputs System.out.println("Minimized from " + randomFA.getNodes().size() + " to " + result.getNodes().size()); result = new TransducerGraph(result, ntsp); // pull out strings from sets returned by minimizer result = new TransducerGraph(result, isp); // split outputs from inputs