public void printLengthAccuracies() { Counter<Integer> accuracies = lengthAccuracies(); Set<Integer> keys = Generics.newTreeSet(); keys.addAll(accuracies.keySet()); log.info("Label accuracy at various lengths:"); for (Integer key : keys) { log.info(StringUtils.padLeft(Integer.toString(key), 4) + ": " + NF.format(accuracies.getCount(key))); } }
Set<String> tags = Generics.newTreeSet(); for (String tag : parser.tagIndex) { tags.add(parser.treebankLanguagePack().basicCategory(tag)); System.out.println("All tags size: " + parser.tagIndex.size()); Set<String> states = Generics.newTreeSet(); for (String state : parser.stateIndex) { states.add(parser.treebankLanguagePack().basicCategory(state));
public void printLengthAccuracies() { Counter<Integer> accuracies = lengthAccuracies(); Set<Integer> keys = Generics.newTreeSet(); keys.addAll(accuracies.keySet()); System.err.println("Label accuracy at various lengths:"); for (Integer key : keys) { System.err.println(StringUtils.padLeft(Integer.toString(key), 4) + ": " + NF.format(accuracies.getCount(key))); } }
/** * Tries to return a <code>Set</code> of leaf (terminal) nodes * which are the {@link GrammaticalRelation#DEPENDENT * <code>DEPENDENT</code>}s of the given node <code>t</code>. * Probably, <code>t</code> should be a leaf node as well. * * @param t a leaf node in this <code>GrammaticalStructure</code> * @return a <code>Set</code> of nodes which are dependents of * node <code>t</code>, or else <code>null</code> */ public Set<TreeGraphNode> getDependents(TreeGraphNode t) { Set<TreeGraphNode> deps = Generics.newTreeSet(); // todo [cdm]: Explore replacing this with direct iteration over Tree Set<Tree> nodes = root.subTrees(); for (Iterator<Tree> it = nodes.iterator(); it.hasNext();) { TreeGraphNode node = (TreeGraphNode) it.next(); TreeGraphNode gov = getGovernor(node); if (gov != null && gov == t) { deps.add(node); } } return deps; }
public void printLengthAccuracies() { Counter<Integer> accuracies = lengthAccuracies(); Set<Integer> keys = Generics.newTreeSet(); keys.addAll(accuracies.keySet()); log.info("Label accuracy at various lengths:"); for (Integer key : keys) { log.info(StringUtils.padLeft(Integer.toString(key), 4) + ": " + NF.format(accuracies.getCount(key))); } }