当前位置: 首页>>代码示例>>C#>>正文


C# AnalyzerAnonymousInnerClassHelper类代码示例

本文整理汇总了C#中AnalyzerAnonymousInnerClassHelper的典型用法代码示例。如果您正苦于以下问题:C# AnalyzerAnonymousInnerClassHelper类的具体用法?C# AnalyzerAnonymousInnerClassHelper怎么用?C# AnalyzerAnonymousInnerClassHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AnalyzerAnonymousInnerClassHelper类属于命名空间,在下文中一共展示了AnalyzerAnonymousInnerClassHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Inform

        public void Inform(IResourceLoader loader)
        {
            TokenizerFactory factory = tokenizerFactory == null ? null : LoadTokenizerFactory(loader, tokenizerFactory);

            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, factory);

            try
            {
                string formatClass = format;
                if (format == null || format.Equals("solr"))
                {
                    formatClass = typeof(SolrSynonymParser).AssemblyQualifiedName;
                }
                else if (format.Equals("wordnet"))
                {
                    formatClass = typeof(WordnetSynonymParser).AssemblyQualifiedName;
                }
                // TODO: expose dedup as a parameter?
                map = LoadSynonyms(loader, formatClass, true, analyzer);
            }
            catch (Exception e)
            {
                throw new IOException("Error parsing synonyms file:", e);
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:25,代码来源:FSTSynonymFilterFactory.cs

示例2: BeforeClass

        public static void BeforeClass()
        {
            Directory = NewDirectory();
            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper();
            RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, analyzer);

            Documents.Document doc = new Documents.Document();
            doc.Add(NewTextField("field", "one two three four five", Field.Store.YES));
            doc.Add(NewTextField("repeated", "this is a repeated field - first part", Field.Store.YES));
            IndexableField repeatedField = NewTextField("repeated", "second part of a repeated field", Field.Store.YES);
            doc.Add(repeatedField);
            doc.Add(NewTextField("palindrome", "one two three two one", Field.Store.YES));
            writer.AddDocument(doc);

            doc = new Documents.Document();
            doc.Add(NewTextField("nonexist", "phrase exist notexist exist found", Field.Store.YES));
            writer.AddDocument(doc);

            doc = new Documents.Document();
            doc.Add(NewTextField("nonexist", "phrase exist notexist exist found", Field.Store.YES));
            writer.AddDocument(doc);

            Reader = writer.Reader;
            writer.Dispose();

            Searcher = NewSearcher(Reader);
        }
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:27,代码来源:TestPhraseQuery.cs

示例3: TestCrossPlaneNormalization

 public virtual void TestCrossPlaneNormalization()
 {
     var analyzer = new AnalyzerAnonymousInnerClassHelper();
     var num = 1000 * RANDOM_MULTIPLIER;
     for (var i = 0; i < num; i++)
     {
         var s = TestUtil.RandomUnicodeString(Random());
         var ts = analyzer.TokenStream("foo", s);
         try
         {
             ts.Reset();
             var offsetAtt = ts.AddAttribute<IOffsetAttribute>();
             while (ts.IncrementToken())
             {
                 var highlightedText = s.Substring(offsetAtt.StartOffset(), offsetAtt.EndOffset() - offsetAtt.StartOffset());
                 for (int j = 0, cp = 0; j < highlightedText.Length; j += Character.CharCount(cp))
                 {
                     cp = char.ConvertToUtf32(highlightedText, j);
                     assertTrue("non-letter:" + cp.ToString("x"), Character.IsLetter(cp));
                 }
             }
             ts.End();
         }
         finally
         {
             IOUtils.CloseWhileHandlingException(ts);
         }
     }
     // just for fun
     CheckRandomData(Random(), analyzer, num);
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:31,代码来源:TestCharTokenizers.cs

示例4: testEmptyTerm

 //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()
 {
     foreach (String lang in SNOWBALL_LANGS)
     {
       Analyzer a = new AnalyzerAnonymousInnerClassHelper(this);
       checkOneTerm(a, "", "");
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:10,代码来源:TestSnowball.cs

示例5: testRandomStrings

        /// <summary>
        /// blast some random strings through the analyzer </summary>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testRandomStrings() throws Exception
        public virtual void testRandomStrings()
        {
            Analyzer a = new AnalyzerAnonymousInnerClassHelper(this);
            checkRandomData(random(), a, 1000 * RANDOM_MULTIPLIER);

            Analyzer b = new AnalyzerAnonymousInnerClassHelper2(this);
            checkRandomData(random(), b, 1000 * RANDOM_MULTIPLIER);
        }
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:12,代码来源:TestPatternReplaceFilter.cs

示例6: Test

        public virtual void Test()
        {
            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this);

            AssertAnalyzesTo(analyzer, "aab", new string[] { "aab" }, new int[] { 0 }, new int[] { 3 });

            AssertAnalyzesTo(analyzer, "aabaa", new string[] { "aabaa" }, new int[] { 0 }, new int[] { 5 });

            AssertAnalyzesTo(analyzer, "aabcdefgaa", new string[] { "aabcdefgaa" }, new int[] { 0 }, new int[] { 10 });
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:10,代码来源:TestMockCharFilter.cs

示例7: TestRandomStrings

        public virtual void TestRandomStrings()
        {
            ISet<string> words = new HashSet<string>();
            words.Add("a");
            words.Add("b");

            Analyzer a = new AnalyzerAnonymousInnerClassHelper(this, words);

            CheckRandomData(Random(), a, 1000 * RANDOM_MULTIPLIER);
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:10,代码来源:TestKeepWordFilter.cs

示例8: testCharFilters

        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testCharFilters() throws Exception
        public virtual void testCharFilters()
        {
            Analyzer a = new AnalyzerAnonymousInnerClassHelper(this);
            assertAnalyzesTo(a, "ab", new string[] {"aab"}, new int[] {0}, new int[] {2});

            // now wrap in PFAW
            PerFieldAnalyzerWrapper p = new PerFieldAnalyzerWrapper(a, System.Linq.Enumerable.Empty<string, Analyzer>());

            assertAnalyzesTo(p, "ab", new string[] {"aab"}, new int[] {0}, new int[] {2});
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:12,代码来源:TestPerFieldAnalyzerWrapper.cs

示例9: TestCharFilters

        public virtual void TestCharFilters()
        {
            Analyzer a = new AnalyzerAnonymousInnerClassHelper(this);
            AssertAnalyzesTo(a, "ab", new string[] { "aab" }, new int[] { 0 }, new int[] { 2 });

            // now wrap in PFAW
            PerFieldAnalyzerWrapper p = new PerFieldAnalyzerWrapper(a, new Dictionary<string, Analyzer>());

            AssertAnalyzesTo(p, "ab", new string[] { "aab" }, new int[] { 0 }, new int[] { 2 });
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:10,代码来源:TestPerFieldAnalyzerWrapper.cs

示例10: TestLetterAscii

 public virtual void TestLetterAscii()
 {
     Random random = Random();
     Analyzer left = new MockAnalyzer(random, jvmLetter, false);
     Analyzer right = new AnalyzerAnonymousInnerClassHelper(this);
     for (int i = 0; i < 1000; i++)
     {
         string s = TestUtil.RandomSimpleString(random);
         assertEquals(s, left.TokenStream("foo", newStringReader(s)), right.TokenStream("foo", newStringReader(s)));
     }
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:11,代码来源:TestDuelingAnalyzers.cs

示例11: assertCorrectOutput

        /// <summary>
        /// For the supplied language, run the stemmer against all strings in voc.txt
        /// The output should be the same as the string in output.txt
        /// </summary>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: private void assertCorrectOutput(final String snowballLanguage, String dataDirectory) throws java.io.IOException
        //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        private void assertCorrectOutput(string snowballLanguage, string dataDirectory)
        {
            if (VERBOSE)
            {
            Console.WriteLine("checking snowball language: " + snowballLanguage);
            }

            Analyzer a = new AnalyzerAnonymousInnerClassHelper(this, snowballLanguage);

            assertVocabulary(a, getDataFile("TestSnowballVocabData.zip"), dataDirectory + "/voc.txt", dataDirectory + "/output.txt");
        }
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:18,代码来源:TestSnowballVocab.cs

示例12: testRandomStrings

        /// <summary>
        /// blast some random strings through the analyzer </summary>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testRandomStrings() throws Exception
        public virtual void testRandomStrings()
        {
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final java.util.Set<String> words = new java.util.HashSet<>();
            ISet<string> words = new HashSet<string>();
            words.Add("a");
            words.Add("b");

            Analyzer a = new AnalyzerAnonymousInnerClassHelper(this, words);

            checkRandomData(random(), a, 1000 * RANDOM_MULTIPLIER);
        }
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:16,代码来源:TestKeepWordFilter.cs

示例13: Test

        public virtual void Test()
        {
            CharArraySet cas = new CharArraySet(TEST_VERSION_CURRENT, 3, false);
            cas.add("jjp");
            cas.add("wlmwoknt");
            cas.add("tcgyreo");

            NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
            builder.Add("mtqlpi", "");
            builder.Add("mwoknt", "jjp");
            builder.Add("tcgyreo", "zpfpajyws");
            NormalizeCharMap map = builder.Build();

            Analyzer a = new AnalyzerAnonymousInnerClassHelper(this, cas, map);
            CheckAnalysisConsistency(Random(), a, false, "wmgddzunizdomqyj");
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:16,代码来源:TestBugInSomething.cs

示例14: TestSynonyms

        public virtual void TestSynonyms()
        {
            WordnetSynonymParser parser = new WordnetSynonymParser(true, true, new MockAnalyzer(Random()));
            parser.Parse(new StringReader(synonymsFile));
            SynonymMap map = parser.Build();

            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, map);

            /* all expansions */
            AssertAnalyzesTo(analyzer, "Lost in the woods", new string[] { "Lost", "in", "the", "woods", "wood", "forest" }, new int[] { 0, 5, 8, 12, 12, 12 }, new int[] { 4, 7, 11, 17, 17, 17 }, new int[] { 1, 1, 1, 1, 0, 0 });

            /* single quote */
            AssertAnalyzesTo(analyzer, "king", new string[] { "king", "baron" });

            /* multi words */
            AssertAnalyzesTo(analyzer, "king's evil", new string[] { "king's", "king's", "evil", "meany" });
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:17,代码来源:TestWordnetSynonymParser.cs

示例15: TestMaxPosition2

        public virtual void TestMaxPosition2()
        {
            foreach (bool consumeAll in new bool[] { true, false })
            {
                Analyzer a = new AnalyzerAnonymousInnerClassHelper(consumeAll);

                // don't use assertAnalyzesTo here, as the end offset is not the end of the string (unless consumeAll is true, in which case its correct)!
                AssertTokenStreamContents(a.TokenStream("dummy", "1  2     3  4  5"), new string[] { "1", "2" }, new int[] { 0, 3 }, new int[] { 1, 4 }, consumeAll ? 16 : (int?)null);
                AssertTokenStreamContents(a.TokenStream("dummy", new StringReader("1 2 3 4 5")), new string[] { "1", "2" }, new int[] { 0, 2 }, new int[] { 1, 3 }, consumeAll ? 9 : (int?)null);

                // less than the limit, ensure we behave correctly
                AssertTokenStreamContents(a.TokenStream("dummy", "1  "), new string[] { "1" }, new int[] { 0 }, new int[] { 1 }, consumeAll ? 3 : (int?)null);

                // equal to limit
                AssertTokenStreamContents(a.TokenStream("dummy", "1  2  "), new string[] { "1", "2" }, new int[] { 0, 3 }, new int[] { 1, 4 }, consumeAll ? 6 : (int?)null);
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:17,代码来源:TestLimitTokenPositionFilter.cs


注:本文中的AnalyzerAnonymousInnerClassHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。