Beispiel #1
0
        public void PositonOfWOrds()
        {
            Lucene.Net.Analysis.Analyzer analyzer = AnalyzerList[0].LuceneAnalyzer as Analyzer;

            int termCounter = 0;

            if (analyzer != null)
            {
                AnalyzerView view         = AnalyzerViews[0] as AnalyzerView;
                StringReader stringReader = new StringReader(sb.ToString());

                TokenStream tokenStream = analyzer.TokenStream("defaultFieldName", stringReader);

                String strValue = view.GetView(tokenStream, out termCounter).Trim();
                Console.WriteLine("PositonOfWOrds Details : " + strValue);
            }
        }
Beispiel #2
0
        public void WordCountFrequency()
        {
            Lucene.Net.Analysis.Analyzer analyzer = AnalyzerList[0].LuceneAnalyzer as Analyzer;

            int termCounter = 0;

            if (analyzer != null)
            {
                AnalyzerView view         = AnalyzerViews[1] as AnalyzerView;
                StringReader stringReader = new StringReader(sb.ToString());

                TokenStream tokenStream = analyzer.TokenStream("defaultFieldName", stringReader);

                String strValue = view.GetView(tokenStream, out termCounter).Trim();
                Console.WriteLine("WordCountFrequency Details : " + strValue);
            }
            Console.WriteLine(string.Format("Total of {0} Term(s) Found.", termCounter));
        }