/** * Returns a string representation of a Counter, displaying the keys and their * counts in decreasing order of count. At most k keys are displayed. * * @param counter A Counter. * @param k * The number of keys to include. Use Integer.MAX_VALUE to include * all keys. * @param itemFormat * The format string for key/count pairs, where the key is first and * the value is second. To display the value first, use argument * indices, e.g. "%2$f %1$s". * @param joiner * The string used between pairs of key/value strings. * @return The top k values from the Counter, formatted as specified. */ public static <T> String toSortedString(Counter<T> counter, int k, String itemFormat, String joiner) { return toSortedString(counter, k, itemFormat, joiner, "%s"); }
sbuild.append(Counters.toSortedString(labeledErrorCounts, Integer.MAX_VALUE, "\t%2$f\t%1$s", "\n")); sbuild.append("\n"); sbuild.append("\nUnlabeled Attachment Error Counts\n"); sbuild.append(Counters.toSortedString(unlabeledErrorCounts, Integer.MAX_VALUE, "\t%2$f\t%1$s", "\n"));
private static void outputCalibrationInfo(PrintWriter pw, Counter<Integer> calibration, Counter<Integer> correctByBin, TwoDimensionalCounter<Integer, String> calibratedTokens) { final int numBins = 10; pw.println(); // in practice may well be in middle of line when called pw.println("----------------------------------------"); pw.println("Probability distribution given to tokens (Counts for all class-token pairs; accuracy for this bin; examples are gold entity tokens in bin)"); pw.println("----------------------------------------"); for (int i = 0; i < numBins; i++) { pw.printf("[%.1f-%.1f%c: %.0f %.2f%n", ((double) i) / numBins, ((double) (i+1)) / numBins, i == (numBins - 1) ? ']': ')', calibration.getCount(i), correctByBin.getCount(i) / calibration.getCount(i)); } pw.println("----------------------------------------"); for (int i = 0; i < numBins; i++) { pw.printf("[%.1f-%.1f%c: %s%n", ((double) i) / numBins, ((double) (i+1)) / numBins, i == (numBins - 1) ? ']': ')', Counters.toSortedString(calibratedTokens.getCounter(i), 20, "%s=%.0f", ", ", "[%s]")); } pw.println("----------------------------------------"); }
Counters.toSortedString(weights, weights.size(), "%1$s:%2$f", "\n"), externalFeatureWeightsFileLabel, "utf8");
wordsOutput.write("\n" + Counters.toSortedString(identifiedWords, identifiedWords.size(), "%1$s", "\n")); wordsOutput.flush();
CoreAnnotations.AnswerAnnotation.class, evalPerEntity); // System.out.println("False Positives: " + Counters.toSortedString(wordFP, wordFP.size(), "%s:%.2f", ";")); System.out.println("False Negatives: " + Counters.toSortedString(wordFN, wordFN.size(), "%s:%.2f", ";"));
Redwood.log("Expanding positives by adding " + Counters.toSortedString(closeToPositivesFirstIter, closeToPositivesFirstIter.size(),"%1$s:%2$f", "\t")+ " phrases"); Redwood.log("Expanding negatives by adding " + Counters.toSortedString(closeToNegativesFirstIter , closeToNegativesFirstIter.size(), "%1$s:%2$f","\t")+ " phrases"); allNegativePhrases.addAll(closeToNegativesFirstIter.keySet());
ConstantsAndVariables.minimaldebug, "\n\n## Selected Words for " + label + " : " + Counters.toSortedString(finalwords, finalwords.size(), "%1$s:%2$.2f", "\t")); word + " extracted because of patterns: \t" + Counters.toSortedString(wordsPatExtracted.getCounter(word), wordsPatExtracted.getCounter(word).size(), "%1$s:%2$f", "\n"));
Redwood.DBG, "Positive Words:" + Counters.toSortedString(patternsandWords4Label.getCounter(key), patternsandWords4Label.getCounter(key).size(), "%1$s:%2$f", ";")); + Counters.toSortedString(negPatternsandWords4Label.getCounter(key), negPatternsandWords4Label.getCounter(key).size(), "%1$s:%2$f", ";")); Redwood.DBG, "Unlabeled Words:" + Counters.toSortedString(unLabeledPatternsandWords4Label.getCounter(key), unLabeledPatternsandWords4Label.getCounter(key).size(), "%1$s:%2$f", ";"));
tfidfScores.setCount(en.getKey(), score); Redwood.log(ConstantsAndVariables.extremedebug, "BEFORE IDF " + Counters.toSortedString(tfidfScores, 100, "%1$s:%2$f", "\t")); Counters.divideInPlace(tfidfScores, Data.processedDataFreq);
/** * Returns a string representation of a Counter, displaying the keys and * their counts in decreasing order of count. At most k keys are displayed. * * @param counter A Counter. * @param k The number of keys to include. Use Integer.MAX_VALUE to * include all keys. * @param itemFormat The format string for key/count pairs, where the key is * first and the value is second. To display the value first, * use argument indices, e.g. "%2$f %1$s". * @param joiner The string used between pairs of key/value strings. * @return The top k values from the Counter, formatted as specified. */ public static <T> String toSortedString( Counter<T> counter, int k, String itemFormat, String joiner) { return toSortedString(counter, k, itemFormat, joiner, "%s"); }
/** * Returns a string representation of a Counter, displaying the keys and their * counts in decreasing order of count. At most k keys are displayed. * * @param counter A Counter. * @param k * The number of keys to include. Use Integer.MAX_VALUE to include * all keys. * @param itemFormat * The format string for key/count pairs, where the key is first and * the value is second. To display the value first, use argument * indices, e.g. "%2$f %1$s". * @param joiner * The string used between pairs of key/value strings. * @return The top k values from the Counter, formatted as specified. */ public static <T> String toSortedString(Counter<T> counter, int k, String itemFormat, String joiner) { return toSortedString(counter, k, itemFormat, joiner, "%s"); }
/** * Returns a string representation of a Counter, displaying the keys and their * counts in decreasing order of count. At most k keys are displayed. * * @param counter A Counter. * @param k * The number of keys to include. Use Integer.MAX_VALUE to include * all keys. * @param itemFormat * The format string for key/count pairs, where the key is first and * the value is second. To display the value first, use argument * indices, e.g. "%2$f %1$s". * @param joiner * The string used between pairs of key/value strings. * @return The top k values from the Counter, formatted as specified. */ public static <T> String toSortedString(Counter<T> counter, int k, String itemFormat, String joiner) { return toSortedString(counter, k, itemFormat, joiner, "%s"); }
/** * Returns a string representation of a Counter, displaying the keys and their * counts in decreasing order of count. At most k keys are displayed. * * @param counter * A Counter. * @param k * The number of keys to include. Use Integer.MAX_VALUE to include * all keys. * @param itemFormat * The format string for key/count pairs, where the key is first and * the value is second. To display the value first, use argument * indices, e.g. "%2$f %1$s". * @param joiner * The string used between pairs of key/value strings. * @return The top k values from the Counter, formatted as specified. */ public static <T> String toSortedString(Counter<T> counter, int k, String itemFormat, String joiner) { return toSortedString(counter, k, itemFormat, joiner, "%s"); }
sbuild.append(Counters.toSortedString(labeledErrorCounts, Integer.MAX_VALUE, "\t%2$f\t%1$s", "\n")); sbuild.append("\n"); sbuild.append("\nUnlabeled Attachment Error Counts\n"); sbuild.append(Counters.toSortedString(unlabeledErrorCounts, Integer.MAX_VALUE, "\t%2$f\t%1$s", "\n"));
private static void outputCalibrationInfo(PrintWriter pw, Counter<Integer> calibration, Counter<Integer> correctByBin, TwoDimensionalCounter<Integer, String> calibratedTokens) { final int numBins = 10; pw.println(); // in practice may well be in middle of line when called pw.println("----------------------------------------"); pw.println("Probability distribution given to tokens (Counts for all class-token pairs; accuracy for this bin; examples are gold entity tokens in bin)"); pw.println("----------------------------------------"); for (int i = 0; i < numBins; i++) { pw.printf("[%.1f-%.1f%c: %.0f %.2f%n", ((double) i) / numBins, ((double) (i+1)) / numBins, i == (numBins - 1) ? ']': ')', calibration.getCount(i), correctByBin.getCount(i) / calibration.getCount(i)); } pw.println("----------------------------------------"); for (int i = 0; i < numBins; i++) { pw.printf("[%.1f-%.1f%c: %s%n", ((double) i) / numBins, ((double) (i+1)) / numBins, i == (numBins - 1) ? ']': ')', Counters.toSortedString(calibratedTokens.getCounter(i), 20, "%s=%.0f", ", ", "[%s]")); } pw.println("----------------------------------------"); }
Counters.toSortedString(weights, weights.size(), "%1$s:%2$f", "\n"), externalFeatureWeightsFileLabel, "utf8");
Counters.toSortedString(weights, weights.size(), "%1$s:%2$f", "\n"), externalFeatureWeightsFileLabel, "utf8");
wordsOutput.write("\n" + Counters.toSortedString(identifiedWords, identifiedWords.size(), "%1$s", "\n")); wordsOutput.flush();
CoreAnnotations.AnswerAnnotation.class, evalPerEntity); // System.out.println("False Positives: " + Counters.toSortedString(wordFP, wordFP.size(), "%s:%.2f", ";")); System.out.println("False Negatives: " + Counters.toSortedString(wordFN, wordFN.size(), "%s:%.2f", ";"));