public static Edu.Stanford.Nlp.Patterns.LuceneSentenceIndex LoadIndex(Properties props, ICollection <string> stopwords, string dir, IFunction <CoreLabel, IDictionary <string, string> > transformSentenceToString)
 {
     try
     {
         Edu.Stanford.Nlp.Patterns.LuceneSentenceIndex sentindex = new Edu.Stanford.Nlp.Patterns.LuceneSentenceIndex(props, stopwords, dir, transformSentenceToString);
         sentindex.SetIndexReaderSearcher();
         System.Console.Out.WriteLine("Number of documents read from the index " + dir + " are " + sentindex.reader.NumDocs());
         sentindex.numAllSentences += sentindex.reader.NumDocs();
         return(sentindex);
     }
     catch (IOException e)
     {
         throw new Exception(e);
     }
 }
 public static Edu.Stanford.Nlp.Patterns.LuceneSentenceIndex CreateIndex(IDictionary <string, IList <CoreLabel> > sentences, Properties props, ICollection <string> stopWords, string indexDiskDir, IFunction <CoreLabel, IDictionary <string, string> >
                                                                         transformer)
 {
     try
     {
         Edu.Stanford.Nlp.Patterns.LuceneSentenceIndex sentindex = new Edu.Stanford.Nlp.Patterns.LuceneSentenceIndex(props, stopWords, indexDiskDir, transformer);
         System.Console.Out.WriteLine("Creating lucene index at " + indexDiskDir);
         IOUtils.DeleteDirRecursively(sentindex.indexDir);
         if (sentences != null)
         {
             sentindex.SetIndexWriter();
             sentindex.Add(sentences, true);
             sentindex.CloseIndexWriter();
             sentindex.SetIndexReaderSearcher();
             System.Console.Out.WriteLine("Number of documents added are " + sentindex.reader.NumDocs());
             sentindex.numAllSentences += sentindex.reader.NumDocs();
         }
         return(sentindex);
     }
     catch (IOException e)
     {
         throw new Exception(e);
     }
 }