---
title: "mmseg4j 分词速度"
author: "chenlb"
date: "2009-03-28T17:03:03Z"
tags: []
categories: ["企业架构"]
slug: "mmseg4j"
draft: false
lastmod: "2009-03-29T22:02:47Z"
id: 356711
url: "https://chenlb.iteye.com/blog/356711"
---

看一下 mmseg4j 的分词速度如何，下载了两篇长篇小说共2.5M左右，可以到 <http://mmseg4j.googlecode.com/files/txt.zip>。2.5M的数据，用Complex模式是 5.3秒左右，不知是快还是慢（因为没有对比），Simple 模式用了2.9秒。(AMD athlon 64 2800+ 1G内存 xp)

以上数据是在 eclipse 上运行

代码有两个版本：用Analyzer方式的和不依赖Lucene Analyzer方式的，前者比较简洁 

可以到 svn 上看：<http://mmseg4j.googlecode.com/svn/trunk/example/com/chenlb/mmseg4j/example/>，源码。


命令行运行, txt 是*.txt 的目录：
M:\eclipse 3.3.2\workspace\mmseg4j>java -cp bin -Djava.ext.dirs=lib com.chenlb.mmseg4j.example.PerformanceAnalyzer txt

load dic use time=859ms
use 4921ms

simple 模式
M:\eclipse 3.3.2\workspace\mmseg4j>java -cp bin -Djava.ext.dirs=lib -Dmode=simple com.chenlb.mmseg4j.example.PerformanceAnalyzer txt

load dic use time=547ms
use 2421ms

mmseg4j 项目地址 <http://code.google.com/p/mmseg4j/>