/// <summary>The implementation of what to run on a command-line call of CoreNLPWebClient</summary> /// <exception cref="System.IO.IOException">If any IO problem</exception> public virtual void Run() { StanfordRedwoodConfiguration.MinimalSetup(); StanfordCoreNLP.OutputFormat outputFormat = StanfordCoreNLP.OutputFormat.ValueOf(properties.GetProperty("outputFormat", "text").ToUpper()); // // Process one file or a directory of files // if (properties.Contains("file") || properties.Contains("textFile")) { string fileName = properties.GetProperty("file"); if (fileName == null) { fileName = properties.GetProperty("textFile"); } ICollection <File> files = new FileSequentialCollection(new File(fileName), properties.GetProperty("extension"), true); StanfordCoreNLP.ProcessFiles(null, files, 1, properties, null, StanfordCoreNLP.CreateOutputter(properties, new AnnotationOutputter.Options()), outputFormat, false); } else { // // Process a list of files // if (properties.Contains("filelist")) { string fileName = properties.GetProperty("filelist"); ICollection <File> inputFiles = StanfordCoreNLP.ReadFileList(fileName); ICollection <File> files = new List <File>(inputFiles.Count); foreach (File file in inputFiles) { if (file.IsDirectory()) { Sharpen.Collections.AddAll(files, new FileSequentialCollection(new File(fileName), properties.GetProperty("extension"), true)); } else { files.Add(file); } } StanfordCoreNLP.ProcessFiles(null, files, 1, properties, null, StanfordCoreNLP.CreateOutputter(properties, new AnnotationOutputter.Options()), outputFormat, false); } else { // // Run the interactive shell // Shell(this); } } }