import java.io.IOException;
import java.io.StringReader;
import com.chenlb.mmseg4j.Chunk;
import com.chenlb.mmseg4j.ComplexSeg;
import com.chenlb.mmseg4j.Dictionary;
import com.chenlb.mmseg4j.MMSeg;
import com.chenlb.mmseg4j.Seg;
import com.chenlb.mmseg4j.SimpleSeg;
public class TestFenCi{
public static void main(String[] args) throws IOException{
String txt = "";
txt = "我是中国人。";
Dictionary dic = new Dictionary();
Seg seg = null;
// seg = new SimpleSeg(dic);
seg = new ComplexSeg(dic);
MMSeg mmSeg = new MMSeg(new StringReader(txt), seg);
Chunk chunk = null;
while((chunk=mmSeg.next())!=null) {
for(char[] word : chunk.getWords()) {
if(word != null) {
System.out.print(new String(word)+"|");
}
}
}
}
}
import java.io.StringReader;
import com.chenlb.mmseg4j.Chunk;
import com.chenlb.mmseg4j.ComplexSeg;
import com.chenlb.mmseg4j.Dictionary;
import com.chenlb.mmseg4j.MMSeg;
import com.chenlb.mmseg4j.Seg;
import com.chenlb.mmseg4j.SimpleSeg;
public class TestFenCi{
public static void main(String[] args) throws IOException{
String txt = "";
txt = "我是中国人。";
Dictionary dic = new Dictionary();
Seg seg = null;
// seg = new SimpleSeg(dic);
seg = new ComplexSeg(dic);
MMSeg mmSeg = new MMSeg(new StringReader(txt), seg);
Chunk chunk = null;
while((chunk=mmSeg.next())!=null) {
for(char[] word : chunk.getWords()) {
if(word != null) {
System.out.print(new String(word)+"|");
}
}
}
}
}