Class FineGrainedReportListener
java.lang.Object
opennlp.tools.cmdline.FineGrainedReportListener
- Direct Known Subclasses:
DoccatFineGrainedReportListener, LanguageDetectorFineGrainedReportListener, LemmatizerFineGrainedReportListener, POSTaggerFineGrainedReportListener, TokenNameFinderFineGrainedReportListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a line in the confusion table.static classImplements a simple counterstatic classstatic classstatic classA comparator that sorts the confusion matrix labels according to the accuracy of each linestatic classclass -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char[]private final PrintStreamprivate final FineGrainedReportListener.Stats -
Constructor Summary
ConstructorsConstructorDescriptionFineGrainedReportListener(OutputStream outputStream) Writes the report to theOutputStream.FineGrainedReportListener(PrintStream printStream) -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringformatNumber(String pattern, Object value) Applies aMessageFormatnumber pattern usingLocale.ROOT, so that the figures in a report stay identical regardless of the JVM's defaultLocale.private static StringgenerateAlphaLabel(int index) private doubleprivate doubleprivate double[][]private double[][]getConfusionMatrix(String token) getConfusionMatrixTagset(String token) getMatrixLabelComparator(Map<String, FineGrainedReportListener.ConfusionMatrixLine> confusionMatrix) private intprivate intprivate longprivate intprotected FineGrainedReportListener.StatsgetStats()private intgetTagErrors(String tag) private doublegetTagFMeasure(String tag) private intgetTagFrequency(String tag) private doublegetTagPrecision(String tag) private doublegetTagRecall(String tag) private doublegetTokenAccuracy(String token) private intgetTokenErrors(String token) private intgetTokenFrequency(String token) private StringmatrixToString(SortedSet<String> tagset, double[][] data, boolean filter) protected voidprivate voidprintFooter(String text) Auxiliary method that prints a marker to the end of a reportprotected voidprotected voidprivate voidprintHeader(String text) Auxiliary method that prints a emphasised report headerprivate voidprintLine(int size) Auxiliary method that prints a horizontal line of a given sizeprotected voidprotected voidprotected voidabstract void
-
Field Details
-
alpha
private static final char[] alpha -
printStream
-
stats
-
-
Constructor Details
-
FineGrainedReportListener
-
FineGrainedReportListener
Writes the report to theOutputStream. Should be called only after the evaluation process.
-
-
Method Details
-
generateAlphaLabel
-
writeReport
public abstract void writeReport() -
getStats
-
getNumberOfSentences
private long getNumberOfSentences() -
getAverageSentenceSize
private double getAverageSentenceSize() -
getMinSentenceSize
private int getMinSentenceSize() -
getMaxSentenceSize
private int getMaxSentenceSize() -
getNumberOfTags
private int getNumberOfTags() -
getAccuracy
private double getAccuracy() -
getTokenAccuracy
-
getTokensOrderedByFrequency
-
getTokenFrequency
-
getTokenErrors
-
getTokensOrderedByNumberOfErrors
-
getTagsOrderedByErrors
-
getTagFrequency
-
getTagErrors
-
getTagPrecision
-
getTagRecall
-
getTagFMeasure
-
getConfusionMatrixTagset
-
getConfusionMatrixTagset
-
formatNumber
Applies aMessageFormatnumber pattern usingLocale.ROOT, so that the figures in a report stay identical regardless of the JVM's defaultLocale.- Parameters:
pattern- TheMessageFormatpattern to apply.value- The value to format.- Returns:
- The formatted value.
-
getConfusionMatrix
private double[][] getConfusionMatrix() -
getConfusionMatrix
-
matrixToString
-
printGeneralStatistics
protected void printGeneralStatistics() -
printTokenOccurrencesRank
protected void printTokenOccurrencesRank() -
printTokenErrorRank
protected void printTokenErrorRank() -
printTagsErrorRank
protected void printTagsErrorRank() -
printGeneralConfusionTable
protected void printGeneralConfusionTable() -
printDetailedConfusionMatrix
protected void printDetailedConfusionMatrix() -
printHeader
Auxiliary method that prints a emphasised report header -
printLine
private void printLine(int size) Auxiliary method that prints a horizontal line of a given size -
getMatrixLabelComparator
public Comparator<String> getMatrixLabelComparator(Map<String, FineGrainedReportListener.ConfusionMatrixLine> confusionMatrix) -
getLabelComparator
-