/// <summary> /// Calculate sister annotation statistics suitable for doing /// selective sister splitting in the PCFGParser inside the /// FactoredParser. /// </summary> /// <param name="args">One argument: path to the Treebank</param> public static void Main(string[] args) { ClassicCounter <string> c = new ClassicCounter <string>(); c.SetCount("A", 0); c.SetCount("B", 1); double d = Counters.KlDivergence(c, c); System.Console.Out.WriteLine("KL Divergence: " + d); string encoding = "UTF-8"; if (args.Length > 1) { encoding = args[1]; } if (args.Length < 1) { System.Console.Out.WriteLine("Usage: ParentAnnotationStats treebankPath"); } else { SisterAnnotationStats pas = new SisterAnnotationStats(); Treebank treebank = new DiskTreebank(null, encoding); treebank.LoadPath(args[0]); treebank.Apply(pas); pas.PrintStats(); } }
/// <summary>Go through trees and determine their heads and print them.</summary> /// <remarks> /// Go through trees and determine their heads and print them. /// Just for debugging. <br /> /// Usage: <code> /// java edu.stanford.nlp.trees.international.spanish.SpanishHeadFinder treebankFilePath /// </code> /// </remarks> /// <param name="args">The treebankFilePath</param> public static void Main(string[] args) { Treebank treebank = new DiskTreebank(); CategoryWordTag.suppressTerminalDetails = true; treebank.LoadPath(args[0]); IHeadFinder chf = new Edu.Stanford.Nlp.Trees.International.Spanish.SpanishHeadFinder(); treebank.Apply(new _ITreeVisitor_146(chf)); }
/// <summary>Go through trees and determine their heads and print them.</summary> /// <remarks> /// Go through trees and determine their heads and print them. /// Just for debugging. <br /> /// Usage: <code> /// java edu.stanford.nlp.trees.DybroFrenchHeadFinder treebankFilePath /// </code> /// </remarks> /// <param name="args">The treebankFilePath</param> public static void Main(string[] args) { Treebank treebank = new DiskTreebank(); CategoryWordTag.suppressTerminalDetails = true; treebank.LoadPath(args[0]); IHeadFinder chf = new Edu.Stanford.Nlp.Trees.International.French.DybroFrenchHeadFinder(); treebank.Apply(null); }
public static void Main(string[] args) { // simple testing code Treebank treebank = new DiskTreebank(); CategoryWordTag.suppressTerminalDetails = true; treebank.LoadPath(args[0]); IHeadFinder chf = new NoPunctuationHeadFinder(); treebank.Apply(null); }
/// <summary> /// Calculate parent annotation statistics suitable for doing /// selective parent splitting in the PCFGParser inside /// FactoredParser. /// </summary> /// <remarks> /// Calculate parent annotation statistics suitable for doing /// selective parent splitting in the PCFGParser inside /// FactoredParser. <p> /// Usage: java edu.stanford.nlp.parser.lexparser.ParentAnnotationStats /// [-tags] treebankPath /// </remarks> /// <param name="args">One argument: path to the Treebank</param> public static void Main(string[] args) { bool doTags = false; if (args.Length < 1) { System.Console.Out.WriteLine("Usage: java edu.stanford.nlp.parser.lexparser.ParentAnnotationStats [-tags] treebankPath"); } else { int i = 0; bool useCutOff = false; double cutOff = 0.0; while (args[i].StartsWith("-")) { if (args[i].Equals("-tags")) { doTags = true; i++; } else { if (args[i].Equals("-cutOff") && i + 1 < args.Length) { useCutOff = true; cutOff = double.ParseDouble(args[i + 1]); i += 2; } else { log.Info("Unknown option: " + args[i]); i++; } } } Treebank treebank = new DiskTreebank(null); treebank.LoadPath(args[i]); if (useCutOff) { ICollection <string> splitters = GetSplitCategories(treebank, doTags, 0, cutOff, cutOff, null); System.Console.Out.WriteLine(splitters); } else { Edu.Stanford.Nlp.Parser.Lexparser.ParentAnnotationStats pas = new Edu.Stanford.Nlp.Parser.Lexparser.ParentAnnotationStats(null, doTags); treebank.Apply(pas); pas.PrintStats(); } } }