protected boolean addOneUnaryRule(UnaryRule rule, Map<String, TransducerGraph> graphs) { String parentString = stateIndex.get(rule.parent); String childString = stateIndex.get(rule.child); if (isSyntheticState(parentString)) { String topcat = getTopCategoryOfSyntheticState(parentString); TransducerGraph graph = getGraphFromMap(graphs, topcat); Double output = new Double(smartNegate(rule.score())); graph.addArc(graph.getStartNode(), parentString, childString, output); return true; } else if (isSyntheticState(childString)) { // need to add Arc from synthetic state to endState TransducerGraph graph = getGraphFromMap(graphs, parentString); Double output = new Double(smartNegate(rule.score())); graph.addArc(childString, parentString, END, output); // parentString should the the same as endState graph.setEndNode(parentString); return true; } else { return false; } }
UnaryRule ur = rules.get(0); double localTreeScore = ur.score();
protected boolean addOneUnaryRule(UnaryRule rule, Map<String, TransducerGraph> graphs) { String parentString = (String) stateNumberer.object(rule.parent); String childString = (String) stateNumberer.object(rule.child); if (isSyntheticState(parentString)) { String topcat = getTopCategoryOfSyntheticState(parentString); TransducerGraph graph = getGraphFromMap(graphs, topcat); Double output = new Double(smartNegate(rule.score())); graph.addArc(graph.getStartNode(), parentString, childString, output); return true; } else if (isSyntheticState(childString)) { // need to add Arc from synthetic state to endState TransducerGraph graph = getGraphFromMap(graphs, parentString); Double output = new Double(smartNegate(rule.score())); graph.addArc(childString, parentString, END, output); // parentString should the the same as endState graph.setEndNode(parentString); return true; } else { return false; } }
protected boolean addOneUnaryRule(UnaryRule rule, Map<String, TransducerGraph> graphs) { String parentString = stateIndex.get(rule.parent); String childString = stateIndex.get(rule.child); if (isSyntheticState(parentString)) { String topcat = getTopCategoryOfSyntheticState(parentString); TransducerGraph graph = getGraphFromMap(graphs, topcat); Double output = new Double(smartNegate(rule.score())); graph.addArc(graph.getStartNode(), parentString, childString, output); return true; } else if (isSyntheticState(childString)) { // need to add Arc from synthetic state to endState TransducerGraph graph = getGraphFromMap(graphs, parentString); Double output = new Double(smartNegate(rule.score())); graph.addArc(childString, parentString, END, output); // parentString should the the same as endState graph.setEndNode(parentString); return true; } else { return false; } }
protected boolean addOneUnaryRule(UnaryRule rule, Map<String, TransducerGraph> graphs) { String parentString = stateIndex.get(rule.parent); String childString = stateIndex.get(rule.child); if (isSyntheticState(parentString)) { String topcat = getTopCategoryOfSyntheticState(parentString); TransducerGraph graph = getGraphFromMap(graphs, topcat); Double output = new Double(smartNegate(rule.score())); graph.addArc(graph.getStartNode(), parentString, childString, output); return true; } else if (isSyntheticState(childString)) { // need to add Arc from synthetic state to endState TransducerGraph graph = getGraphFromMap(graphs, parentString); Double output = new Double(smartNegate(rule.score())); graph.addArc(childString, parentString, END, output); // parentString should the the same as endState graph.setEndNode(parentString); return true; } else { return false; } }
protected boolean addOneUnaryRule(UnaryRule rule, Map<String, TransducerGraph> graphs) { String parentString = stateIndex.get(rule.parent); String childString = stateIndex.get(rule.child); if (isSyntheticState(parentString)) { String topcat = getTopCategoryOfSyntheticState(parentString); TransducerGraph graph = getGraphFromMap(graphs, topcat); Double output = new Double(smartNegate(rule.score())); graph.addArc(graph.getStartNode(), parentString, childString, output); return true; } else if (isSyntheticState(childString)) { // need to add Arc from synthetic state to endState TransducerGraph graph = getGraphFromMap(graphs, parentString); Double output = new Double(smartNegate(rule.score())); graph.addArc(childString, parentString, END, output); // parentString should the the same as endState graph.setEndNode(parentString); return true; } else { return false; } }