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


C# org.apache.lucene.analysis.util.CharArraySet.contains方法代码示例

本文整理汇总了C#中org.apache.lucene.analysis.util.CharArraySet.contains方法的典型用法代码示例。如果您正苦于以下问题:C# org.apache.lucene.analysis.util.CharArraySet.contains方法的具体用法?C# org.apache.lucene.analysis.util.CharArraySet.contains怎么用?C# org.apache.lucene.analysis.util.CharArraySet.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.analysis.util.CharArraySet的用法示例。


在下文中一共展示了org.apache.lucene.analysis.util.CharArraySet.contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testStopListPositions

        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testStopListPositions() throws java.io.IOException
        public virtual void testStopListPositions()
        {
            CharArraySet stopWordsSet = new CharArraySet(TEST_VERSION_CURRENT, asSet("good", "test", "analyzer"), false);
            StopAnalyzer newStop = new StopAnalyzer(TEST_VERSION_CURRENT, stopWordsSet);
            string s = "This is a good test of the english stop analyzer with positions";
            int[] expectedIncr = new int[] {1, 1, 1, 3, 1, 1, 1, 2, 1};
            TokenStream stream = newStop.tokenStream("test", s);
            try
            {
              assertNotNull(stream);
              int i = 0;
              CharTermAttribute termAtt = stream.getAttribute(typeof(CharTermAttribute));
              PositionIncrementAttribute posIncrAtt = stream.addAttribute(typeof(PositionIncrementAttribute));

              stream.reset();
              while (stream.incrementToken())
              {
            string text = termAtt.ToString();
            assertFalse(stopWordsSet.contains(text));
            assertEquals(expectedIncr[i++],posIncrAtt.PositionIncrement);
              }
              stream.end();
            }
            finally
            {
              IOUtils.closeWhileHandlingException(stream);
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:30,代码来源:TestStopAnalyzer.cs

示例2: testStopList

        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testStopList() throws java.io.IOException
        public virtual void testStopList()
        {
            CharArraySet stopWordsSet = new CharArraySet(TEST_VERSION_CURRENT, asSet("good", "test", "analyzer"), false);
            StopAnalyzer newStop = new StopAnalyzer(TEST_VERSION_CURRENT, stopWordsSet);
            TokenStream stream = newStop.tokenStream("test", "This is a good test of the english stop analyzer");
            try
            {
              assertNotNull(stream);
              CharTermAttribute termAtt = stream.getAttribute(typeof(CharTermAttribute));

              stream.reset();
              while (stream.incrementToken())
              {
            string text = termAtt.ToString();
            assertFalse(stopWordsSet.contains(text));
              }
              stream.end();
            }
            finally
            {
              IOUtils.closeWhileHandlingException(stream);
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:25,代码来源:TestStopAnalyzer.cs

示例3: uniqueStems

 /// <summary>
 /// Find the unique stem(s) of the provided word
 /// </summary>
 /// <param name="word"> Word to find the stems for </param>
 /// <returns> List of stems for the word </returns>
 public IList<CharsRef> uniqueStems(char[] word, int length)
 {
     IList<CharsRef> stems = stem(word, length);
     if (stems.Count < 2)
     {
       return stems;
     }
     CharArraySet terms = new CharArraySet(Version.LUCENE_CURRENT, 8, dictionary.ignoreCase);
     IList<CharsRef> deduped = new List<CharsRef>();
     foreach (CharsRef s in stems)
     {
       if (!terms.contains(s))
       {
     deduped.Add(s);
     terms.add(s);
       }
     }
     return deduped;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:24,代码来源:Stemmer.cs


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