• R/O
  • SSH
  • HTTPS

igo: Commit


Commit MetaInfo

Revision106 (tree)
Time2011-12-02 22:20:39
Authorphjgt

Log Message

簡易ベンチマーク用クラス追加

Change Summary

Incremental Difference

--- trunk/igo/src/net/reduls/igo/bin/IgoBench.java (nonexistent)
+++ trunk/igo/src/net/reduls/igo/bin/IgoBench.java (revision 106)
@@ -0,0 +1,33 @@
1+package net.reduls.igo.bin;
2+
3+import java.io.IOException;
4+import java.util.ArrayList;
5+import net.reduls.igo.Tagger;
6+import net.reduls.igo.Morpheme;
7+import net.reduls.igo.util.ReadLine;
8+
9+/**
10+ * 簡易ベンチマークコマンド
11+ */
12+public final class IgoBench {
13+ public static void main(String[] args) throws IOException {
14+ if(args.length!=1) {
15+ System.err.println("Usage: java net.reduls.igo.bin.IgoBench <dictionary directory>");
16+ System.exit(1);
17+ }
18+ final String dicDir = args[0];
19+ final Tagger tagger = new Tagger(dicDir);
20+ final ReadLine rl = new ReadLine(System.in);
21+
22+ ArrayList<String> result = new ArrayList<String>();
23+ int morphemeCount = 0;
24+ long beg_t = System.currentTimeMillis();
25+ for(String s=rl.read(); s != null; s=rl.read()) {
26+ result.clear();
27+ morphemeCount += tagger.wakati(s, result).size();
28+ }
29+
30+ System.out.println("elapsed: "+(System.currentTimeMillis()-beg_t)+" ms");
31+ System.out.println("morpheme count: "+morphemeCount);
32+ }
33+}
Show on old repository browser