/// <summary>Usage: java QuoteAttributionEvaluation path_to_properties_file</summary> /// <param name="args"/> /// <exception cref="System.Exception"/> public static void Main(string[] args) { // make the first argument one for a base directory if (args.Length != 1) { System.Console.Out.WriteLine("Usage: java QuoteAttributionEvaluation path_to_properties_file"); System.Environment.Exit(1); } string specificFile = args[0]; System.Console.Out.WriteLine("Using properties file: " + specificFile); Properties props = StringUtils.PropFileToProperties(specificFile); //convert XML file to (1) the Annotation (data.doc) (2) a list of people in the text (data.personList) // and (3) the gold info to be used by evaluate (data.goldList). XMLToAnnotation.Data data = XMLToAnnotation.ReadXMLFormat(props.GetProperty("file")); Properties annotatorProps = new Properties(); // XMLToAnnotation.writeCharacterList("characterListPP.txt", data.personList); //Use this to write the person list to a file annotatorProps.SetProperty("charactersPath", props.GetProperty("charactersPath")); annotatorProps.SetProperty("booknlpCoref", props.GetProperty("booknlpCoref")); annotatorProps.SetProperty("familyWordsFile", props.GetProperty("familyWordsFile")); annotatorProps.SetProperty("animacyWordsFile", props.GetProperty("animacyWordsFile")); annotatorProps.SetProperty("genderNamesFile", props.GetProperty("genderNamesFile")); annotatorProps.SetProperty("modelPath", props.GetProperty("modelPath")); QuoteAttributionAnnotator qaa = new QuoteAttributionAnnotator(annotatorProps); qaa.Annotate(data.doc); Evaluate(data.doc, data.goldList); }
/// <exception cref="System.Exception"/> public static void Main(string[] args) { string home = "/home/mjfang/action_grammars/"; // make the first argument one for a base directory string specificFile = "1PPDevUncollapsed.props"; if (args.Length >= 1) { home = args[0]; } if (args.Length >= 2) { specificFile = args[1]; } System.Console.Out.WriteLine("Base directory: " + home); Properties props = StringUtils.PropFileToProperties(home + "ExtractQuotesXMLScripts/" + specificFile); XMLToAnnotation.Data data = XMLToAnnotation.ReadXMLFormat(props.GetProperty("file")); Properties propsPara = new Properties(); propsPara.SetProperty("paragraphBreak", "one"); ParagraphAnnotator pa = new ParagraphAnnotator(propsPara, false); pa.Annotate(data.doc); Properties annotatorProps = new Properties(); annotatorProps.SetProperty("charactersPath", props.GetProperty("charactersPath")); //"characterList.txt" annotatorProps.SetProperty("booknlpCoref", props.GetProperty("booknlpCoref")); annotatorProps.SetProperty("modelPath", props.GetProperty("modelPath")); //"model.ser"); QuoteAttributionAnnotator qaa = new QuoteAttributionAnnotator(annotatorProps); qaa.Annotate(data.doc); ChapterAnnotator ca = new ChapterAnnotator(); ca.Annotate(data.doc); Train(data, annotatorProps); }