Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testEmptyTerm() throws java.io.IOException
        public virtual void testEmptyTerm()
        {
            Random random = random();

            for (int i = 0; i < 512; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int flags = i;
                int flags = i;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.analysis.util.CharArraySet protectedWords;
                CharArraySet protectedWords;
                if (random.nextBoolean())
                {
                    protectedWords = new CharArraySet(TEST_VERSION_CURRENT, new HashSet <>("a", "b", "cd"), false);
                }
                else
                {
                    protectedWords = null;
                }

                Analyzer a = new AnalyzerAnonymousInnerClassHelper8(this, flags, protectedWords);
                // depending upon options, this thing may or may not preserve the empty term
                checkAnalysisConsistency(random, a, random.nextBoolean(), "");
            }
        }
        public virtual void TestRepeatsOn()
        {
            b = new SynonymMap.Builder(false);
            const bool keepOrig = false;

            Add("a b", "ab", keepOrig);
            Add("a b", "ab", keepOrig);
            Add("a b", "ab", keepOrig);
            SynonymMap map = b.Build();
            Analyzer   a   = new AnalyzerAnonymousInnerClassHelper8(this, map);

            AssertAnalyzesTo(a, "a b", new string[] { "ab", "ab", "ab" }, new int[] { 1, 0, 0 });
        }
Ejemplo n.º 3
0
        public virtual void TestEmptyTerm()
        {
            Random random = Random;

            for (int i = 0; i < 512; i++)
            {
                WordDelimiterFlags flags = (WordDelimiterFlags)i;
                CharArraySet       protectedWords;
                if (random.nextBoolean())
                {
                    protectedWords = new CharArraySet(TEST_VERSION_CURRENT, new string[] { "a", "b", "cd" }, false);
                }
                else
                {
                    protectedWords = null;
                }

                Analyzer a = new AnalyzerAnonymousInnerClassHelper8(this, flags, protectedWords);
                // depending upon options, this thing may or may not preserve the empty term
                CheckAnalysisConsistency(random, a, random.nextBoolean(), "");
            }
        }
Ejemplo n.º 4
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testEmptyTerm() throws java.io.IOException
        public virtual void testEmptyTerm()
        {
            Random random = random();
            for (int i = 0; i < 512; i++)
            {
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final int flags = i;
              int flags = i;
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final org.apache.lucene.analysis.util.CharArraySet protectedWords;
              CharArraySet protectedWords;
              if (random.nextBoolean())
              {
            protectedWords = new CharArraySet(TEST_VERSION_CURRENT, new HashSet<>("a", "b", "cd"), false);
              }
              else
              {
            protectedWords = null;
              }

              Analyzer a = new AnalyzerAnonymousInnerClassHelper8(this, flags, protectedWords);
              // depending upon options, this thing may or may not preserve the empty term
              checkAnalysisConsistency(random, a, random.nextBoolean(), "");
            }
        }
        public virtual void TestEmptyTerm()
        {
            Random random = Random();
            for (int i = 0; i < 512; i++)
            {
                int flags = i;
                CharArraySet protectedWords;
                if (random.nextBoolean())
                {
                    protectedWords = new CharArraySet(TEST_VERSION_CURRENT, new string[] { "a", "b", "cd" }, false);
                }
                else
                {
                    protectedWords = null;
                }

                Analyzer a = new AnalyzerAnonymousInnerClassHelper8(this, flags, protectedWords);
                // depending upon options, this thing may or may not preserve the empty term
                CheckAnalysisConsistency(random, a, random.nextBoolean(), "");
            }
        }
Ejemplo n.º 6
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testRepeatsOn() throws Exception
        public virtual void testRepeatsOn()
        {
            b = new SynonymMap.Builder(false);
            const bool keepOrig = false;
            add("a b", "ab", keepOrig);
            add("a b", "ab", keepOrig);
            add("a b", "ab", keepOrig);
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final SynonymMap map = b.build();
            SynonymMap map = b.build();
            Analyzer a = new AnalyzerAnonymousInnerClassHelper8(this, map);

            assertAnalyzesTo(a, "a b", new string[] {"ab", "ab", "ab"}, new int[] {1, 0, 0});
        }
        public virtual void TestRepeatsOn()
        {
            b = new SynonymMap.Builder(false);
            const bool keepOrig = false;
            Add("a b", "ab", keepOrig);
            Add("a b", "ab", keepOrig);
            Add("a b", "ab", keepOrig);
            SynonymMap map = b.Build();
            Analyzer a = new AnalyzerAnonymousInnerClassHelper8(this, map);

            AssertAnalyzesTo(a, "a b", new string[] { "ab", "ab", "ab" }, new int[] { 1, 0, 0 });
        }