a = new Arc(a); // make a copy if (arcProcessor != null) { a = arcProcessor.processArc(a);
for (Arc arc : graph.getArcs()) { String source = arc.getSourceNode().toString(); String target = arc.getTargetNode().toString(); Object input = arc.getInput(); String inputString = input.toString(); double output = ((Double) arc.getOutput()).doubleValue(); if (source.equals(startNode)) {
double sourceLambda = lambda.getCount(arc.getSourceNode()); double targetLambda = lambda.getCount(arc.getTargetNode()); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + targetLambda - sourceLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + startLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput - endLambda; arc.setOutput(new Double(newOutput));
double sourceLambda = lambda.getCount(arc.getSourceNode()); double targetLambda = lambda.getCount(arc.getTargetNode()); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + targetLambda - sourceLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + startLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput - endLambda; arc.setOutput(new Double(newOutput));
double sourceLambda = lambda.getCount(arc.getSourceNode()); double targetLambda = lambda.getCount(arc.getTargetNode()); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + targetLambda - sourceLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + startLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput - endLambda; arc.setOutput(new Double(newOutput));
double sourceLambda = lambda.getCount(arc.getSourceNode()); double targetLambda = lambda.getCount(arc.getTargetNode()); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + targetLambda - sourceLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + startLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput - endLambda; arc.setOutput(new Double(newOutput));
double sourceLambda = lambda.getCount(arc.getSourceNode()); double targetLambda = lambda.getCount(arc.getTargetNode()); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + targetLambda - sourceLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput + startLambda; arc.setOutput(new Double(newOutput)); double oldOutput = ((Double) arc.getOutput()).doubleValue(); double newOutput = oldOutput - endLambda; arc.setOutput(new Double(newOutput));
a = new Arc(a); // make a copy if (arcProcessor != null) { a = arcProcessor.processArc(a);
a = new Arc(a); // make a copy if (arcProcessor != null) { a = arcProcessor.processArc(a);
b.append(" "); if (getEndNodes().contains(newArc.getTargetNode())) { b.append(newArc + " END\n"); } else { depthFirstSearchHelper(newArc.getTargetNode(), marked, level + 1, forward, b); } else { depthFirstSearchHelper(newArc.getSourceNode(), marked, level + 1, forward, b);
a = new Arc(a); // make a copy if (arcProcessor != null) { a = arcProcessor.processArc(a);
Object source = a.getSourceNode(); Object target = a.getTargetNode(); Object input = a.getInput(); if (source == null || target == null || input == null) { return false;
Object source = a.getSourceNode(); Object target = a.getTargetNode(); Object input = a.getInput(); if (source == null || target == null || input == null) { return false;
b.append(" "); if (getEndNodes().contains(newArc.getTargetNode())) { b.append(newArc + " END\n"); } else { depthFirstSearchHelper(newArc.getTargetNode(), marked, level + 1, forward, b); } else { depthFirstSearchHelper(newArc.getSourceNode(), marked, level + 1, forward, b);
b.append(" "); if (getEndNodes().contains(newArc.getTargetNode())) { b.append(newArc + " END\n"); } else { depthFirstSearchHelper(newArc.getTargetNode(), marked, level + 1, forward, b); } else { depthFirstSearchHelper(newArc.getSourceNode(), marked, level + 1, forward, b);
a = new Arc(a); // make a copy if (arcProcessor != null) { a = arcProcessor.processArc(a);
public static void addOnePathToGraph(List path, double count, int markovOrder, TransducerGraph graph) { Object source = graph.getStartNode(); for (int j = 0; j < path.size(); j++) { Object input = path.get(j); Arc a = graph.getArcBySourceAndInput(source, input); if (a != null) { // increment the arc weight a.output = new Double(((Double) a.output).doubleValue() + count); } else { Object target; if (input.equals(TransducerGraph.EPSILON_INPUT)) { target = "END"; // to ensure they all share the same end node } else if (markovOrder == 0) { // we all transition back to the same state target = source; } else if (markovOrder > 0) { // the state is described by the partial history target = path.subList((j < markovOrder ? 0 : j - markovOrder + 1), j + 1); } else { // the state is described by the full history target = path.subList(0, j + 1); } Double output = new Double(count); a = new Arc(source, target, input, output); graph.addArc(a); } source = a.getTargetNode(); } graph.setEndNode(source); }
Object source = a.getSourceNode(); Object target = a.getTargetNode(); Object input = a.getInput(); if (source == null || target == null || input == null) { return false;
public static void addOnePathToGraph(List path, double count, int markovOrder, TransducerGraph graph) { Object source = graph.getStartNode(); Object input, target; for (int j = 0; j < path.size(); j++) { input = path.get(j); Arc a = graph.getArcBySourceAndInput(source, input); if (a != null) { // increment the arc weight a.output = new Double(((Double) a.output).doubleValue() + count); } else { if (input.equals(TransducerGraph.EPSILON_INPUT)) { target = "END"; // to ensure they all share the same end node } else if (markovOrder == 0) { // we all transition back to the same state target = source; } else if (markovOrder > 0) { // the state is described by the partial history target = path.subList((j < markovOrder ? 0 : j - markovOrder + 1), j + 1); } else { // the state is described by the full history target = path.subList(0, j + 1); } Double output = new Double(count); a = new Arc(source, target, input, output); graph.addArc(a); } source = a.getTargetNode(); } graph.setEndNode(source); }
public static void addOnePathToGraph(List path, double count, int markovOrder, TransducerGraph graph) { Object source = graph.getStartNode(); for (int j = 0; j < path.size(); j++) { Object input = path.get(j); Arc a = graph.getArcBySourceAndInput(source, input); if (a != null) { // increment the arc weight a.output = new Double(((Double) a.output).doubleValue() + count); } else { Object target; if (input.equals(TransducerGraph.EPSILON_INPUT)) { target = "END"; // to ensure they all share the same end node } else if (markovOrder == 0) { // we all transition back to the same state target = source; } else if (markovOrder > 0) { // the state is described by the partial history target = path.subList((j < markovOrder ? 0 : j - markovOrder + 1), j + 1); } else { // the state is described by the full history target = path.subList(0, j + 1); } Double output = new Double(count); a = new Arc(source, target, input, output); graph.addArc(a); } source = a.getTargetNode(); } graph.setEndNode(source); }