private static void CountTaggings(Treebank tb, PrintWriter pw) { TwoDimensionalCounter <string, string> wtc = new TwoDimensionalCounter <string, string>(); tb.Apply(null); foreach (string key in wtc.FirstKeySet()) { pw.Print(key); pw.Print('\t'); ICounter <string> ctr = wtc.GetCounter(key); foreach (string k2 in ctr.KeySet()) { pw.Print(k2 + '\t' + ctr.GetCount(k2) + '\t'); } pw.Println(); } }
private static void RunTiming(Treebank treebank) { System.Console.Out.WriteLine(); Timing.StartTime(); int num = 0; foreach (Tree t in treebank) { num += t.Yield().Count; } Timing.EndTime("traversing corpus, counting words with iterator"); log.Info("There were " + num + " words in the treebank."); treebank.Apply(new _ITreeVisitor_352()); // = 0; log.Info(); Timing.EndTime("traversing corpus, counting words with TreeVisitor"); log.Info("There were " + num + " words in the treebank."); log.Info(); Timing.StartTime(); log.Info("This treebank contains " + treebank.Count + " trees."); Timing.EndTime("size of corpus"); }