本文整理汇总了C#中MockTokenizer类的典型用法代码示例。如果您正苦于以下问题:C# MockTokenizer类的具体用法?C# MockTokenizer怎么用?C# MockTokenizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockTokenizer类属于命名空间,在下文中一共展示了MockTokenizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCaseInsensitive
public virtual void TestCaseInsensitive()
{
TextReader reader = new StringReader("L'avion");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = TokenFilterFactory("Elision", "articles", "frenchArticles.txt", "ignoreCase", "true").Create(stream);
AssertTokenStreamContents(stream, new string[] { "avion" });
}
示例2: testStemming
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStemming() throws Exception
public virtual void testStemming()
{
Reader reader = new StringReader("cariñosa");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("GalicianStem").create(stream);
assertTokenStreamContents(stream, new string[] {"cariñ"});
}
示例3: TestStemming
public virtual void TestStemming()
{
TextReader reader = new StringReader("questões");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = TokenFilterFactory("PortugueseMinimalStem").Create(stream);
AssertTokenStreamContents(stream, new string[] { "questão" });
}
示例4: testTrimming
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testTrimming() throws Exception
public virtual void testTrimming()
{
Reader reader = new StringReader("trim me ");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.KEYWORD, false);
stream = tokenFilterFactory("Trim").create(stream);
assertTokenStreamContents(stream, new string[] {"trim me"});
}
示例5: testNormalization
/// <summary>
/// Ensure the filter actually lowercases (and a bit more) greek text.
/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testNormalization() throws Exception
public virtual void testNormalization()
{
Reader reader = new StringReader("Μάϊος ΜΆΪΟΣ");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("GreekLowerCase").create(stream);
assertTokenStreamContents(stream, new string[] {"μαιοσ", "μαιοσ"});
}
示例6: testConsumeAllTokens
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testConsumeAllTokens() throws Exception
public virtual void testConsumeAllTokens()
{
Reader reader = new StringReader("A1 B2 C3 D4 E5 F6");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("LimitTokenPosition", "maxTokenPosition", "3", "consumeAllTokens", "true").create(stream);
assertTokenStreamContents(stream, new string[] {"A1", "B2", "C3"});
}
示例7: testCapitalization12
/// <summary>
/// test with numbers </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testCapitalization12() throws Exception
public virtual void testCapitalization12()
{
Reader reader = new StringReader("1st 2nd third");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("Capitalization", "keep", "and the it BIG", "onlyFirstWord", "false", "minWordLength", "3", "okPrefix", "McK", "forceFirstLetter", "false").create(stream);
assertTokenStreamContents(stream, new string[] {"1st", "2nd", "Third"});
}
示例8: testFiltering
/// <summary>
/// Ensure the filter actually normalizes text (numerics, stopwords)
/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testFiltering() throws Exception
public virtual void testFiltering()
{
Reader reader = new StringReader("this 1234 Is such a silly filter");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("Chinese").create(stream);
assertTokenStreamContents(stream, new string[] {"Is", "silly", "filter"});
}
示例9: testASCIIFolding
/// <summary>
/// Ensure the ASCIIFoldingFilterFactory works
/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testASCIIFolding() throws Exception
public virtual void testASCIIFolding()
{
Reader reader = new StringReader("Česká");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("ASCIIFolding").create(stream);
assertTokenStreamContents(stream, new string[] {"Ceska"});
}
示例10: testCapitalization
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testCapitalization() throws Exception
public virtual void testCapitalization()
{
Reader reader = new StringReader("kiTTEN");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("Capitalization", "keep", "and the it BIG", "onlyFirstWord", "true").create(stream);
assertTokenStreamContents(stream, new string[] {"Kitten"});
}
示例11: testStemming
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStemming() throws Exception
public virtual void testStemming()
{
Reader reader = new StringReader("äpplen äpple");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("SwedishLightStem").create(stream);
assertTokenStreamContents(stream, new string[] {"äppl", "äppl"});
}
示例12: testStemming
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStemming() throws Exception
public virtual void testStemming()
{
Reader reader = new StringReader("abc");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("HunspellStem", "dictionary", "simple.dic", "affix", "simple.aff").create(stream);
assertTokenStreamContents(stream, new string[] {"ab"});
}
示例13: TestStemmingInflectional
public virtual void TestStemmingInflectional()
{
TextReader reader = new StringReader("dibukukannya");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = TokenFilterFactory("IndonesianStem", "stemDerivational", "false").Create(stream);
AssertTokenStreamContents(stream, new string[] { "dibukukan" });
}
示例14: testStemming
/// <summary>
/// Ensure the filter actually stems and normalizes text.
/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStemming() throws Exception
public virtual void testStemming()
{
Reader reader = new StringReader("Brasília");
Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
TokenStream stream = tokenFilterFactory("BrazilianStem").create(tokenizer);
assertTokenStreamContents(stream, new string[] {"brasil"});
}
示例15: testPositionIncrements
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testPositionIncrements() throws Exception
public virtual void testPositionIncrements()
{
Reader reader = new StringReader("foo foobar super-duper-trooper");
TokenStream stream = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
stream = tokenFilterFactory("CodepointCount", "min", "4", "max", "10").create(stream);
assertTokenStreamContents(stream, new string[] {"foobar"}, new int[] {2});
}