本文整理汇总了C#中CharArraySet.add方法的典型用法代码示例。如果您正苦于以下问题:C# CharArraySet.add方法的具体用法?C# CharArraySet.add怎么用?C# CharArraySet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharArraySet
的用法示例。
在下文中一共展示了CharArraySet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestWithStemExclusionSet
public virtual void TestWithStemExclusionSet()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("представление");
Analyzer a = new RussianAnalyzer(TEST_VERSION_CURRENT, RussianAnalyzer.DefaultStopSet, set);
AssertAnalyzesTo(a, "Вместе с тем о силе электромагнитной энергии имели представление еще", new string[] { "вмест", "сил", "электромагнитн", "энерг", "имел", "представление" });
}
示例2: TestWithKeywordAttribute
public virtual void TestWithKeywordAttribute()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("fischen");
GermanStemFilter filter = new GermanStemFilter(new SetKeywordMarkerFilter(new LowerCaseTokenizer(TEST_VERSION_CURRENT, new StringReader("Fischen Trinken")), set));
AssertTokenStreamContents(filter, new string[] { "fischen", "trink" });
}
示例3: TestWithStemExclusionSet
public virtual void TestWithStemExclusionSet()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("строеве");
Analyzer a = new BulgarianAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET, set);
AssertAnalyzesTo(a, "строевете строеве", new string[] { "строй", "строеве" });
}
示例4: TestWithStemExclusionSet
public virtual void TestWithStemExclusionSet()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("پیاوە");
Analyzer a = new SoraniAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET, set);
AssertAnalyzesTo(a, "پیاوە", new string[] { "پیاوە" });
}
示例5: TestWithStemExclusionSet
public virtual void TestWithStemExclusionSet()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("hole");
CzechAnalyzer cz = new CzechAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET, set);
AssertAnalyzesTo(cz, "hole desek", new string[] { "hole", "desk" });
}
示例6: 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");
}
示例7: TestWithKeywordAttribute
public virtual void TestWithKeywordAttribute()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("yourselves");
Tokenizer tokenizer = new MockTokenizer(new StringReader("yourselves yours"), MockTokenizer.WHITESPACE, false);
TokenStream filter = new PorterStemFilter(new SetKeywordMarkerFilter(tokenizer, set));
AssertTokenStreamContents(filter, new string[] { "yourselves", "your" });
}
示例8: TestSetFilterIncrementToken
public virtual void TestSetFilterIncrementToken()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 5, true);
set.add("lucenefox");
string[] output = new string[] { "the", "quick", "brown", "LuceneFox", "jumps" };
AssertTokenStreamContents(new LowerCaseFilterMock(new SetKeywordMarkerFilter(new MockTokenizer(new StringReader("The quIck browN LuceneFox Jumps"), MockTokenizer.WHITESPACE, false), set)), output);
CharArraySet mixedCaseSet = new CharArraySet(TEST_VERSION_CURRENT, AsSet("LuceneFox"), false);
AssertTokenStreamContents(new LowerCaseFilterMock(new SetKeywordMarkerFilter(new MockTokenizer(new StringReader("The quIck browN LuceneFox Jumps"), MockTokenizer.WHITESPACE, false), mixedCaseSet)), output);
CharArraySet set2 = set;
AssertTokenStreamContents(new LowerCaseFilterMock(new SetKeywordMarkerFilter(new MockTokenizer(new StringReader("The quIck browN LuceneFox Jumps"), MockTokenizer.WHITESPACE, false), set2)), output);
}
示例9: GetWordSet
/// <summary>
/// Reads lines from a Reader and adds every line as an entry to a CharArraySet (omitting
/// leading and trailing whitespace). Every line of the Reader should contain only
/// one word. The words need to be in lowercase if you make use of an
/// Analyzer which uses LowerCaseFilter (like StandardAnalyzer).
/// </summary>
/// <param name="reader"> Reader containing the wordlist </param>
/// <param name="result"> the <seealso cref="CharArraySet"/> to fill with the readers words </param>
/// <returns> the given <seealso cref="CharArraySet"/> with the reader's words </returns>
public static CharArraySet GetWordSet(TextReader reader, CharArraySet result)
{
BufferedReader br = null;
try
{
br = getBufferedReader(reader);
string word = null;
while ((word = br.readLine()) != null)
{
result.add(word.Trim());
}
}
finally
{
IOUtils.close(br);
}
return result;
}
示例10: TestWithKeywordAttribute
public virtual void TestWithKeywordAttribute()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("строеве");
MockTokenizer tokenStream = new MockTokenizer(new StringReader("строевете строеве"), MockTokenizer.WHITESPACE, false);
BulgarianStemFilter filter = new BulgarianStemFilter(new SetKeywordMarkerFilter(tokenStream, set));
AssertTokenStreamContents(filter, new string[] { "строй", "строеве" });
}
示例11: TestExclusionTableViaCtor
public virtual void TestExclusionTableViaCtor()
{
#pragma warning disable 612, 618
CharArraySet set = new CharArraySet(LuceneVersion.LUCENE_30, 1, true);
#pragma warning restore 612, 618
set.add("lichamelijk");
DutchAnalyzer a = new DutchAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET, set);
AssertAnalyzesTo(a, "lichamelijk lichamelijke", new string[] { "lichamelijk", "licham" });
a = new DutchAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET, set);
AssertAnalyzesTo(a, "lichamelijk lichamelijke", new string[] { "lichamelijk", "licham" });
}
示例12: TestWithKeywordAttribute
public virtual void TestWithKeywordAttribute()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("Brasília");
BrazilianStemFilter filter = new BrazilianStemFilter(new SetKeywordMarkerFilter(new LowerCaseTokenizer(TEST_VERSION_CURRENT, new StringReader("Brasília Brasilia")), set));
AssertTokenStreamContents(filter, new string[] { "brasília", "brasil" });
}
示例13: TestExclusionTableViaCtor
public virtual void TestExclusionTableViaCtor()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("habitable");
FrenchAnalyzer fa = new FrenchAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET, set);
AssertAnalyzesTo(fa, "habitable chiste", new string[] { "habitable", "chist" });
fa = new FrenchAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET, set);
AssertAnalyzesTo(fa, "habitable chiste", new string[] { "habitable", "chist" });
}
示例14: TestWithKeywordAttribute
public virtual void TestWithKeywordAttribute()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
set.add("ساهدهات");
#pragma warning disable 612, 618
ArabicLetterTokenizer tokenStream = new ArabicLetterTokenizer(TEST_VERSION_CURRENT, new StringReader("ساهدهات"));
#pragma warning restore 612, 618
ArabicStemFilter filter = new ArabicStemFilter(new SetKeywordMarkerFilter(tokenStream, set));
AssertTokenStreamContents(filter, new string[] { "ساهدهات" });
}
示例15: testUnmodifiableSet
public virtual void testUnmodifiableSet()
{
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 10,true);
set.addAll(TEST_STOP_WORDS);
set.add(Convert.ToInt32(1));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int size = set.size();
int size = set.size();
set = CharArraySet.unmodifiableSet(set);
assertEquals("Set size changed due to unmodifiableSet call", size, set.size());
foreach (string stopword in TEST_STOP_WORDS)
{
assertTrue(set.contains(stopword));
}
assertTrue(set.contains(Convert.ToInt32(1)));
assertTrue(set.contains("1"));
assertTrue(set.contains(new char[]{'1'}));
try
{
CharArraySet.unmodifiableSet(null);
fail("can not make null unmodifiable");
}
catch (System.NullReferenceException)
{
// expected
}
}