|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.tumba.spell.Benchmark
public final class Benchmark
This is a benchmarking class, usefull for measuring how well this package is doing.
Field Summary | |
---|---|
private int |
count
Numer of tests in the benchmark. |
private java.lang.String |
dictionaryName
The File path leading up to the dictionary used for the benchmarks. |
private int |
missed
Number of missed spelling corrections. |
private java.util.List |
missedTerms
A List of all spelling mistakes that were missed. |
private java.io.PrintWriter |
outStream
To where the benchmark statistics will be outputed. |
private int |
topFive
Numer of spelling corrections made where the correct word was in the top 5 suggestions. |
private int |
topHundred
Numer of spelling corrections made where the correct word was in the top 100 suggestions. |
private int |
topOne
Numer of spelling corrections made where the correct word was the top suggestion. |
private int |
topTen
Numer of spelling corrections made where the correct word was in the top 10 suggestions. |
Constructor Summary | |
---|---|
Benchmark(java.lang.String dictionaryName)
Constructor for Benchmark. |
Method Summary | |
---|---|
java.lang.String |
add(java.lang.String pBadTerm,
java.lang.String pCorrectTerm,
java.lang.String[] pCandidates)
This method adds a "term : correct" term pair with its corresponding statistic to the benchmark. |
private int |
computeWhereSuggested(java.lang.String pCorrectTerm,
java.lang.String[] pCandidates)
This method returns the position in the candidates list where the correct term was found. |
static void |
main(java.lang.String argv)
This is a test main, whose purpose is to test the functionality of each method developed for this class. |
java.lang.String |
reportStats()
This method reports the statistics for this benchmark. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.io.PrintWriter outStream
private int topOne
private int topFive
private int topTen
private int topHundred
private int count
private int missed
private java.util.List missedTerms
List
of all spelling mistakes that were missed.
private java.lang.String dictionaryName
File
path leading up to the dictionary used for the benchmarks.
Constructor Detail |
---|
public Benchmark(java.lang.String dictionaryName) throws java.lang.Exception
dictionaryName
- The File
path leading up to the dictionary used for the benchmarks.
java.lang.Exception
Method Detail |
---|
public java.lang.String add(java.lang.String pBadTerm, java.lang.String pCorrectTerm, java.lang.String[] pCandidates)
pBadTerm
- The correctly spelled term.pCorrectTerm
- The spelling mistake.pCandidates
- The candidate corrections.
String
with the statistic concerning this benchmark.public java.lang.String reportStats() throws java.lang.Exception
java.lang.Exception
private int computeWhereSuggested(java.lang.String pCorrectTerm, java.lang.String[] pCandidates)
If the correct answer is not found, this method returns -1. What is returned is one based, not zero based. I.e., if the correct term was found in the 0th element, this routine will return 1.
pCorrectTerm
- The correct spelling correction.pCandidates
- A list of Possible corrections.
public static void main(java.lang.String argv)
This main strives to test the boundary conditions as well as some sample common ways each method is intended to be used.
argv
- The command line input, tokenized.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |