Exemplo n.º 1
0
            static DefaultsHolder()
            {
                try
                {
                    DEFAULT_STOP_SET = WordlistLoader.GetWordSet(IOUtils.GetDecodingReader(typeof(PolishAnalyzer),
                                                                                           DEFAULT_STOPWORD_FILE, Encoding.UTF8), "#",
#pragma warning disable 612, 618
                                                                 LuceneVersion.LUCENE_CURRENT);
#pragma warning restore 612, 618
                }
                catch (IOException ex)
                {
                    // default set should always be present as it is part of the
                    // distribution (embedded resource)
                    throw new InvalidOperationException("Unable to load default stopword set", ex);
                }

                try
                {
                    DEFAULT_TABLE = StempelStemmer.Load(typeof(PolishAnalyzer).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(PolishAnalyzer), DEFAULT_STEMMER_FILE));
                }
                catch (IOException ex)
                {
                    // default set should always be present as it is part of the
                    // distribution (embedded resource)
                    throw new InvalidOperationException("Unable to load default stemming tables", ex);
                }
            }
Exemplo n.º 2
0
 private static Trie LoadDefaultTable() // LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006)
 {
     try
     {
         return(StempelStemmer.Load(typeof(PolishAnalyzer).FindAndGetManifestResourceStream(DEFAULT_STEMMER_FILE)));
     }
     catch (Exception ex) when(ex.IsIOException())
     {
         // default set should always be present as it is part of the
         // distribution (embedded resource)
         throw RuntimeException.Create("Unable to load default stemming tables", ex);
     }
 }