parse() public method

public parse ( Reader @in ) : void
@in Reader
return void
Esempio n. 1
0
        /// <summary>
        /// parse a syn file with bad syntax </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected=java.text.ParseException.class) public void testInvalidAnalyzesToNothingOutput() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testInvalidAnalyzesToNothingOutput()
        {
            string            testFile = "a => 1";
            SolrSynonymParser parser   = new SolrSynonymParser(true, true, new MockAnalyzer(random(), MockTokenizer.SIMPLE, false));

            parser.parse(new StringReader(testFile));
        }
Esempio n. 2
0
        /// <summary>
        /// parse a syn file with bad syntax </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected=java.text.ParseException.class) public void testInvalidPositionsOutput() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testInvalidPositionsOutput()
        {
            string            testFile = "the test => testola";
            SolrSynonymParser parser   = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT));

            parser.parse(new StringReader(testFile));
        }
Esempio n. 3
0
        /// <summary>
        /// parse a syn file with bad syntax </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected=java.text.ParseException.class) public void testInvalidDoubleMap() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testInvalidDoubleMap()
        {
            string            testFile = "a => b => c";
            SolrSynonymParser parser   = new SolrSynonymParser(true, true, new MockAnalyzer(random()));

            parser.parse(new StringReader(testFile));
        }
        /// <summary>
        /// parse a syn file with some escaped syntax chars </summary>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testEscapedStuff() throws Exception
        public virtual void testEscapedStuff()
        {
            string testFile = "a\\=>a => b\\=>b\n" + "a\\,a => b\\,b";
            SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(random(), MockTokenizer.KEYWORD, false));
            parser.parse(new StringReader(testFile));
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final SynonymMap map = parser.build();
            SynonymMap map = parser.build();
            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper2(this, map);

            assertAnalyzesTo(analyzer, "ball", new string[] {"ball"}, new int[] {1});

            assertAnalyzesTo(analyzer, "a=>a", new string[] {"b=>b"}, new int[] {1});

            assertAnalyzesTo(analyzer, "a,a", new string[] {"b,b"}, new int[] {1});
        }
Esempio n. 5
0
        /// <summary>
        /// parse a syn file with some escaped syntax chars </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testEscapedStuff() throws Exception
        public virtual void testEscapedStuff()
        {
            string            testFile = "a\\=>a => b\\=>b\n" + "a\\,a => b\\,b";
            SolrSynonymParser parser   = new SolrSynonymParser(true, true, new MockAnalyzer(random(), MockTokenizer.KEYWORD, false));

            parser.parse(new StringReader(testFile));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SynonymMap map = parser.build();
            SynonymMap map      = parser.build();
            Analyzer   analyzer = new AnalyzerAnonymousInnerClassHelper2(this, map);

            assertAnalyzesTo(analyzer, "ball", new string[] { "ball" }, new int[] { 1 });

            assertAnalyzesTo(analyzer, "a=>a", new string[] { "b=>b" }, new int[] { 1 });

            assertAnalyzesTo(analyzer, "a,a", new string[] { "b,b" }, new int[] { 1 });
        }
Esempio n. 6
0
        /// <summary>
        /// Tests some simple examples from the solr wiki </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testSimple() throws Exception
        public virtual void testSimple()
        {
            string testFile = "i-pod, ipod, ipoooood\n" + "foo => foo bar\n" + "foo => baz\n" + "this test, that testing";

            SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(random()));

            parser.parse(new StringReader(testFile));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SynonymMap map = parser.build();
            SynonymMap map = parser.build();

            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, map);

            assertAnalyzesTo(analyzer, "ball", new string[] { "ball" }, new int[] { 1 });

            assertAnalyzesTo(analyzer, "i-pod", new string[] { "i-pod", "ipod", "ipoooood" }, new int[] { 1, 0, 0 });

            assertAnalyzesTo(analyzer, "foo", new string[] { "foo", "baz", "bar" }, new int[] { 1, 0, 1 });

            assertAnalyzesTo(analyzer, "this test", new string[] { "this", "that", "test", "testing" }, new int[] { 1, 0, 1, 0 });
        }
        // LUCENE-3375
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testVanishingTerms() throws Exception
        public virtual void testVanishingTerms()
        {
            string testFile = "aaa => aaaa1 aaaa2 aaaa3\n" + "bbb => bbbb1 bbbb2\n";

            SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(random()));
            parser.parse(new StringReader(testFile));
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final SynonymMap map = parser.build();
            SynonymMap map = parser.build();

            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper5(this, map);

            // where did my pot go?!
            assertAnalyzesTo(analyzer, "xyzzy bbb pot of gold", new string[] {"xyzzy", "bbbb1", "pot", "bbbb2", "of", "gold"});

            // this one nukes 'pot' and 'of'
            // xyzzy aaa pot of gold -> xyzzy aaaa1 aaaa2 aaaa3 gold
            assertAnalyzesTo(analyzer, "xyzzy aaa pot of gold", new string[] {"xyzzy", "aaaa1", "pot", "aaaa2", "of", "aaaa3", "gold"});
        }
 /// <summary>
 /// parse a syn file with bad syntax </summary>
 //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
 //ORIGINAL LINE: @Test(expected=java.text.ParseException.class) public void testInvalidPositionsInput() throws Exception
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 public virtual void testInvalidPositionsInput()
 {
     string testFile = "testola => the test";
     SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT));
     parser.parse(new StringReader(testFile));
 }
 /// <summary>
 /// parse a syn file with bad syntax </summary>
 //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
 //ORIGINAL LINE: @Test(expected=java.text.ParseException.class) public void testInvalidDoubleMap() throws Exception
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 public virtual void testInvalidDoubleMap()
 {
     string testFile = "a => b => c";
     SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(random()));
     parser.parse(new StringReader(testFile));
 }
 /// <summary>
 /// parse a syn file with bad syntax </summary>
 //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
 //ORIGINAL LINE: @Test(expected=java.text.ParseException.class) public void testInvalidAnalyzesToNothingOutput() throws Exception
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 public virtual void testInvalidAnalyzesToNothingOutput()
 {
     string testFile = "a => 1";
     SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(random(), MockTokenizer.SIMPLE, false));
     parser.parse(new StringReader(testFile));
 }
        /// <summary>
        /// Tests some simple examples from the solr wiki </summary>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testSimple() throws Exception
        public virtual void testSimple()
        {
            string testFile = "i-pod, ipod, ipoooood\n" + "foo => foo bar\n" + "foo => baz\n" + "this test, that testing";

            SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(random()));
            parser.parse(new StringReader(testFile));
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final SynonymMap map = parser.build();
            SynonymMap map = parser.build();

            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, map);

            assertAnalyzesTo(analyzer, "ball", new string[] {"ball"}, new int[] {1});

            assertAnalyzesTo(analyzer, "i-pod", new string[] {"i-pod", "ipod", "ipoooood"}, new int[] {1, 0, 0});

            assertAnalyzesTo(analyzer, "foo", new string[] {"foo", "baz", "bar"}, new int[] {1, 0, 1});

            assertAnalyzesTo(analyzer, "this test", new string[] {"this", "that", "test", "testing"}, new int[] {1, 0, 1, 0});
        }