org.getopt.stempel
Class Benchmark

java.lang.Object
  extended byorg.getopt.stempel.Benchmark

public class Benchmark
extends java.lang.Object

This class is a simple benchmark for the stemmer. You need to provide it with a test file, containing words to stem. The file will be processed three times, and at the end the application will print a short report. NOTE: the file encoding is assumed to be UTF-8.

Author:
Andrzej Bialecki <ab@getopt.org>

Field Summary
static int COUNT
          Number of times to run the benchmark.
 
Constructor Summary
Benchmark()
           
 
Method Summary
static void main(java.lang.String[] args)
          Provide the name of the test file as the first argument.
static void printDoubleArray(java.lang.String head, double[] res, java.lang.String fmt)
           
static void printLongArray(java.lang.String head, long[] res)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNT

public static final int COUNT
Number of times to run the benchmark.

See Also:
Constant Field Values
Constructor Detail

Benchmark

public Benchmark()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Provide the name of the test file as the first argument. The test file should contain just the words to stem, any other tokens will skew the results. Words must be separated by space(s) and/or newlines.

The second, optional argument is a resource path to the stemmer table to be used instead of the default one.

Timing includes only the time it takes for the Stemmer.stem(String, boolean) method to return a value. Stemmer.MIN_LENGTH is set to 0 in order to process all input tokens.

Throws:
java.lang.Exception

printLongArray

public static void printLongArray(java.lang.String head,
                                  long[] res)

printDoubleArray

public static void printDoubleArray(java.lang.String head,
                                    double[] res,
                                    java.lang.String fmt)