Ejemplo n.º 1
0
        public void ContainAnalyzerTest()
        {
            LuceneEngine engine = new LuceneEngine();

            engine.Init();
            //string text = "三国演义";
            //string text = "a|f|g|i|m";
            string         text = "NBA常规赛-快船vs凯尔特人";
            TextReader     tr   = new StringReader(text);
            PanGuTokenizer ct   = new PanGuTokenizer(tr);
            int            end  = 0;

            Lucene.Net.Analysis.Token t;
            string ss = string.Empty;

            while (end < text.Length)
            {
                t   = ct.Next();
                end = t.EndOffset();
                ss  = ss + t.TermText() + "/ ";
            }
            string xxx = ss;
        }
Ejemplo n.º 2
0
        public void SpellTest()
        {
            LuceneEngine engine = new LuceneEngine();

            engine.Init();
            var firsts     = SpellUtils.GetCnSegment("NBA常规赛-快船vs凯尔特人");
            var spells     = SpellUtils.GetSpellSegment("战重警和");
            var segment    = new Segment();
            var collection = segment.DoSegment("国际足球100509K联赛釜山-大田");
            var list       = new List <string>();

            foreach (WordInfo word in collection)
            {
                if (word == null)
                {
                    continue;
                }
                list.Add(word.Word);
            }
            //var list = SpellUtils.GetSpellSegment("战警");
            string         sss  = "san国yan义";
            string         ssss = Synacast.LuceneNetSearcher.Searcher.Searcher.SegmentKeyWord(sss);
            string         text = "重庆";
            TextReader     tr   = new StringReader(text);
            PanGuTokenizer ct   = new PanGuTokenizer(tr);
            int            end  = 0;

            Lucene.Net.Analysis.Token t;
            string ss = string.Empty;

            while (end < text.Length)
            {
                t   = ct.Next();
                end = t.EndOffset();
                ss  = ss + t.TermText() + "/ ";
            }
        }