Guys,
this is tiny and probably not relevant. But I'll bet a beer that at least a
dozen people had to dirtymod this class while they could have run it from
command line.
A 15 min time save that took 15 min to create. I guess it's a tie.
Best,
Pablo
--- HighFreqTerms.java
+++ ExtractStopwords.java
@@ -30,7 +30,7 @@
public class HighFreqTerms {
// The top numTerms will be displayed
- public static final int numTerms = 100;
+ public static int numTerms = 100;
public static void main(String[] args) throws Exception {
IndexReader reader = null;
@@ -40,6 +40,10 @@
} else if (args.length == 2) {
reader = IndexReader.open(args[0]);
field = args[1];
+ } else if (args.length == 3) {
+ reader = IndexReader.open(args[0]);
+ field = args[1];
+ numTerms = new Integer(args[2]);
} else {
usage();
System.exit(1);
@@ -71,7 +75,7 @@
private static void usage() {
System.out.println(
"\n\n"
- + "java org.apache.lucene.misc.HighFreqTerms <index dir>
[field]\n\n");
+ + "java org.apache.lucene.misc.HighFreqTerms <index dir> [field]
[numTerms] \n\n");
}
}