本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}