本文整理汇总了C#中AnalyzerAnonymousInnerClassHelper类的典型用法代码示例。如果您正苦于以下问题:C# AnalyzerAnonymousInnerClassHelper类的具体用法?C# AnalyzerAnonymousInnerClassHelper怎么用?C# AnalyzerAnonymousInnerClassHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnalyzerAnonymousInnerClassHelper类属于命名空间,在下文中一共展示了AnalyzerAnonymousInnerClassHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: testSynonyms
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testSynonyms() throws Exception
public virtual void testSynonyms()
{
WordnetSynonymParser parser = new WordnetSynonymParser(true, true, new MockAnalyzer(random()));
parser.parse(new StringReader(synonymsFile));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SynonymMap map = parser.build();
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:WakeflyCBass,项目名称:lucenenet,代码行数:21,代码来源:TestWordnetSynonymParser.cs
示例17: testChangedOffsets
/// <summary>
/// test that offsets are correct when mappingcharfilter is previously applied </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testChangedOffsets() throws java.io.IOException
public virtual void testChangedOffsets()
{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.analysis.charfilter.NormalizeCharMap.Builder builder = new org.apache.lucene.analysis.charfilter.NormalizeCharMap.Builder();
NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
builder.add("a", "一二");
builder.add("b", "二三");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.analysis.charfilter.NormalizeCharMap norm = builder.build();
NormalizeCharMap norm = builder.build();
Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, norm);
assertAnalyzesTo(analyzer, "ab", new string[] {"一二", "二二", "二三"}, new int[] {0, 0, 1}, new int[] {1, 1, 2});
// note: offsets are strange since this is how the charfilter maps them...
// before bigramming, the 4 tokens look like:
// { 0, 0, 1, 1 },
// { 0, 1, 1, 2 }
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:23,代码来源:TestCJKAnalyzer.cs
示例18: test
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test() throws Exception
public virtual void test()
{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.analysis.util.CharArraySet cas = new org.apache.lucene.analysis.util.CharArraySet(TEST_VERSION_CURRENT, 3, false);
CharArraySet cas = new CharArraySet(TEST_VERSION_CURRENT, 3, false);
cas.add("jjp");
cas.add("wlmwoknt");
cas.add("tcgyreo");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.analysis.charfilter.NormalizeCharMap.Builder builder = new org.apache.lucene.analysis.charfilter.NormalizeCharMap.Builder();
NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
builder.add("mtqlpi", "");
builder.add("mwoknt", "jjp");
builder.add("tcgyreo", "zpfpajyws");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.analysis.charfilter.NormalizeCharMap map = builder.build();
NormalizeCharMap map = builder.build();
Analyzer a = new AnalyzerAnonymousInnerClassHelper(this, cas, map);
checkAnalysisConsistency(random(), a, false, "wmgddzunizdomqyj");
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:24,代码来源:TestBugInSomething.cs
示例19: 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()
{
Analyzer a = new AnalyzerAnonymousInnerClassHelper(this);
checkOneTerm(a, "", "");
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:7,代码来源:TestHindiStemmer.cs
示例20: TestAltFillerToken
public virtual void TestAltFillerToken()
{
Analyzer @delegate = new AnalyzerAnonymousInnerClassHelper(this);
ShingleAnalyzerWrapper analyzer = new ShingleAnalyzerWrapper(@delegate, ShingleFilter.DEFAULT_MIN_SHINGLE_SIZE, ShingleFilter.DEFAULT_MAX_SHINGLE_SIZE, ShingleFilter.DEFAULT_TOKEN_SEPARATOR, true, false, "--");
AssertAnalyzesTo(analyzer, "please divide into shingles", new string[] { "please", "please divide", "divide", "divide --", "-- shingles", "shingles" }, new int[] { 0, 0, 7, 7, 19, 19 }, new int[] { 6, 13, 13, 19, 27, 27 }, new int[] { 1, 0, 1, 0, 1, 1 });
analyzer = new ShingleAnalyzerWrapper(@delegate, ShingleFilter.DEFAULT_MIN_SHINGLE_SIZE, ShingleFilter.DEFAULT_MAX_SHINGLE_SIZE, ShingleFilter.DEFAULT_TOKEN_SEPARATOR, false, false, null);
AssertAnalyzesTo(analyzer, "please divide into shingles", new string[] { "please divide", "divide ", " shingles" }, new int[] { 0, 7, 19 }, new int[] { 13, 19, 27 }, new int[] { 1, 1, 1 });
analyzer = new ShingleAnalyzerWrapper(@delegate, ShingleFilter.DEFAULT_MIN_SHINGLE_SIZE, ShingleFilter.DEFAULT_MAX_SHINGLE_SIZE, ShingleFilter.DEFAULT_TOKEN_SEPARATOR, false, false, "");
AssertAnalyzesTo(analyzer, "please divide into shingles", new string[] { "please divide", "divide ", " shingles" }, new int[] { 0, 7, 19 }, new int[] { 13, 19, 27 }, new int[] { 1, 1, 1 });
}
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:13,代码来源:ShingleAnalyzerWrapperTest.cs
注:本文中的AnalyzerAnonymousInnerClassHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论