.net下ICTCLAS原子分词和lucene的Token比较

sharpICTCLAS  参考:http://www.cnblogs.com/zhenyulu/archive/2007/04/18/718383.html
Lucene.net 参考:http://incubator.apache.org/lucene.net/

原子分词效率:短句,sharpICTCLAS快;超过1M的数据,Lucene.net快。
Lucene的优势:英文句子处理的好。
sharpICTCLAS的优势:只关注中文。

测试代码:
Lucene.net

static void Main(string[] args)
        
{
            
string sSentence = @"三星SHX-132型号的(手机)1元钱256.89元12.14%百分比12%。";
            StringBuilder sb 
= new StringBuilder();
            
for (int i = 0; i < 10000;i++ )
            
{
                sb.Append(sSentence);
            }


            DateTime start 
= DateTime.Now;
            TestToken(sb.ToString());
            DateTime finished 
= DateTime.Now;
            TimeSpan span 
= finished-start;
            Console.WriteLine(
"耗时:{0}毫秒",span.TotalMilliseconds);
            Console.ReadLine();
        }


        
public static void TestToken(string sSentence)
        
{

            StandardTokenizer tokenizer 
= new StandardTokenizer(new System.IO.StringReader(sSentence));
            Lucene.Net.Analysis.Token next 
= null;


            
while ((next = tokenizer.Next()) != null)
            
{
                
string str = next.TermText();
            }


        }

下一步考虑使用lucene的Token代替ICTCLAS的原子分词函数。

posted on 2007-08-15 12:15  amber lee zhao  阅读(1063)  评论(4编辑  收藏  举报

导航