//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void assertClasspathDelegation(ResourceLoader rl) throws Exception
        private void assertClasspathDelegation(ResourceLoader rl)
        {
            // try a stopwords file from classpath
            CharArraySet set = WordlistLoader.getSnowballWordSet(new System.IO.StreamReader(rl.openResource("org/apache/lucene/analysis/snowball/english_stop.txt"), Encoding.UTF8), TEST_VERSION_CURRENT);

            assertTrue(set.contains("you"));
            // try to load a class; we use string comparison because classloader may be different...
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            assertEquals("org.apache.lucene.analysis.util.RollingCharBuffer", rl.newInstance("org.apache.lucene.analysis.util.RollingCharBuffer", typeof(object)).GetType().FullName);
            // theoretically classes should also be loadable:
            IOUtils.closeWhileHandlingException(rl.openResource("java/lang/String.class"));
        }
Ejemplo n.º 2
0
 static DefaultSetHolder()
 {
     try
     {
         DEFAULT_STOP_SET = WordlistLoader.getSnowballWordSet(IOUtils.getDecodingReader(typeof(SnowballFilter), DEFAULT_STOPWORD_FILE, StandardCharsets.UTF_8), Version.LUCENE_CURRENT);
     }
     catch (IOException)
     {
         // default set should always be present as it is part of the
         // distribution (JAR)
         throw new Exception("Unable to load default stopword set");
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Test stopwords in snowball format
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testSnowballListLoading() throws java.io.IOException
        public virtual void testSnowballListLoading()
        {
            string       s       = "|comment\n" + " |comment\n" + "\n" + "  \t\n" + " |comment | comment\n" + "ONE\n" + "   two   \n" + " three   four five \n" + "six seven | comment\n"; //multiple stopwords + comment -  multiple stopwords -  stopword with leading/trailing space -  stopword, in uppercase -  commented line with comment -  line with only whitespace -  blank line -  commented line with leading whitespace -  commented line
            CharArraySet wordset = WordlistLoader.getSnowballWordSet(new StringReader(s), TEST_VERSION_CURRENT);

            assertEquals(7, wordset.size());
            assertTrue(wordset.contains("ONE"));
            assertTrue(wordset.contains("two"));
            assertTrue(wordset.contains("three"));
            assertTrue(wordset.contains("four"));
            assertTrue(wordset.contains("five"));
            assertTrue(wordset.contains("six"));
            assertTrue(wordset.contains("seven"));
        }
Ejemplo n.º 4
0
            static DefaultSetHolder()
            {
                try
                {
                    DEFAULT_STOP_SET = WordlistLoader.getSnowballWordSet(IOUtils.getDecodingReader(typeof(SnowballFilter), DEFAULT_STOPWORD_FILE, StandardCharsets.UTF_8), Version.LUCENE_CURRENT);
                }
                catch (IOException)
                {
                    // default set should always be present as it is part of the
                    // distribution (JAR)
                    throw new Exception("Unable to load default stopword set");
                }

                DEFAULT_STEM_DICT = new CharArrayMap <>(Version.LUCENE_CURRENT, 4, false);
                DEFAULT_STEM_DICT.put("fiets", "fiets");         //otherwise fiet
                DEFAULT_STEM_DICT.put("bromfiets", "bromfiets"); //otherwise bromfiet
                DEFAULT_STEM_DICT.put("ei", "eier");
                DEFAULT_STEM_DICT.put("kind", "kinder");
            }