public static void Train(XMLToAnnotation.Data data, Properties props) { IDictionary <string, IList <Person> > characterMap = QuoteAttributionUtils.ReadPersonMap(props.GetProperty("charactersPath")); IDictionary <int, string> pronounCorefMap = QuoteAttributionUtils.SetupCoref(props.GetProperty("booknlpCoref"), characterMap, data.doc); ICollection <string> animacyList = QuoteAttributionUtils.ReadAnimacyList(QuoteAttributionAnnotator.AnimacyWordList); SupervisedSieveTraining.FeaturesData fd = Featurize(new SupervisedSieveTraining.SieveData(data.doc, characterMap, pronounCorefMap, animacyList), data.goldList, true); ExtractQuotesClassifier quotesClassifier = new ExtractQuotesClassifier(fd.dataset); OutputModel(props.GetProperty("modelPath"), quotesClassifier.GetClassifier()); }
/// <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); }