/// <summary>Loads treebank grammar from first argument and prints it.</summary> /// <remarks> /// Loads treebank grammar from first argument and prints it. /// Just a demonstration of functionality. <br /> /// <code>usage: java MemoryTreebank treebankFilesPath</code> /// </remarks> /// <param name="args">array of command-line arguments</param> public static void Main(string[] args) { Timing.StartTime(); Treebank treebank = new Edu.Stanford.Nlp.Trees.MemoryTreebank(null); treebank.LoadPath(args[0]); Timing.EndTime(); System.Console.Out.WriteLine(treebank); }
/// <summary>Loads treebank grammar from first argument and prints it.</summary> /// <remarks> /// Loads treebank grammar from first argument and prints it. /// Just a demonstration of functionality. <br /> /// <code>usage: java MemoryTreebank treebankFilesPath</code> /// </remarks> /// <param name="args">array of command-line arguments</param> public static void Main(string[] args) { Timing.StartTime(); Treebank treebank = new DiskTreebank(null); Treebank treebank2 = new MemoryTreebank(null); treebank.LoadPath(args[0]); treebank2.LoadPath(args[0]); CompositeTreebank c = new CompositeTreebank(treebank, treebank2); Timing.EndTime(); ITreeTransformer myTransformer = new TransformingTreebank.MyTreeTransformer(); ITreeTransformer myTransformer2 = new TransformingTreebank.MyTreeTransformer2(); ITreeTransformer myTransformer3 = new TransformingTreebank.MyTreeTransformer3(); Treebank tf1 = c.Transform(myTransformer).Transform(myTransformer2).Transform(myTransformer3); Treebank tf2 = new Edu.Stanford.Nlp.Trees.TransformingTreebank(new Edu.Stanford.Nlp.Trees.TransformingTreebank(new Edu.Stanford.Nlp.Trees.TransformingTreebank(c, myTransformer), myTransformer2), myTransformer3); ITreeTransformer[] tta = new ITreeTransformer[] { myTransformer, myTransformer2, myTransformer3 }; ITreeTransformer tt3 = new CompositeTreeTransformer(Arrays.AsList(tta)); Treebank tf3 = c.Transform(tt3); System.Console.Out.WriteLine("-------------------------"); System.Console.Out.WriteLine("COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK"); System.Console.Out.WriteLine(c); System.Console.Out.WriteLine("-------------------------"); System.Console.Out.WriteLine("SLOWLY TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR"); Treebank tx1 = new Edu.Stanford.Nlp.Trees.TransformingTreebank(c, myTransformer); System.Console.Out.WriteLine(tx1); System.Console.Out.WriteLine("-----"); Treebank tx2 = new Edu.Stanford.Nlp.Trees.TransformingTreebank(tx1, myTransformer2); System.Console.Out.WriteLine(tx2); System.Console.Out.WriteLine("-----"); Treebank tx3 = new Edu.Stanford.Nlp.Trees.TransformingTreebank(tx2, myTransformer3); System.Console.Out.WriteLine(tx3); System.Console.Out.WriteLine("-------------------------"); System.Console.Out.WriteLine("TRANSFORMED TREEBANK, USING Treebank.transform()"); System.Console.Out.WriteLine(tf1); System.Console.Out.WriteLine("-------------------------"); System.Console.Out.WriteLine("PRINTING AGAIN TRANSFORMED TREEBANK, USING Treebank.transform()"); System.Console.Out.WriteLine(tf1); System.Console.Out.WriteLine("-------------------------"); System.Console.Out.WriteLine("TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR"); System.Console.Out.WriteLine(tf2); System.Console.Out.WriteLine("-------------------------"); System.Console.Out.WriteLine("TRANSFORMED TREEBANK, USING CompositeTreeTransformer"); System.Console.Out.WriteLine(tf3); System.Console.Out.WriteLine("-------------------------"); System.Console.Out.WriteLine("COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK"); System.Console.Out.WriteLine(c); System.Console.Out.WriteLine("-------------------------"); }
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"); }