?? segmain.java
字號:
package org.ictclas4j.run;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JFrame;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.ictclas4j.bean.SegResult;
import org.ictclas4j.segment.Segment;
import org.ictclas4j.utility.GFString;
/**
* Copyright 2007.6.1 張新波(sinboy)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
*/
public class SegMain {
public static Segment seg;
static Logger logger = Logger.getLogger(SegMain.class);
public SegMain() {
PropertyConfigurator.configure(Config.LOG4J_CONF);
}
public static void main(String[] args) {
SegMain sm = new SegMain();
seg = new Segment(1);
sm.initFrm();
// String[] source = {
// "2006年德國世界杯八分之一決賽馬上要開始",
// "廣州:網(wǎng)絡(luò)警察“巡邏”BBS和博客",
// "18時(shí)42分的球賽就要開始了",
// "張新波住在雅仕苑",
// "張新波在杭州",
// "紅眼病很多",
// "中國人民從此站了起來",
// "三星SHM-100型電視獲得了工業(yè)設(shè)計(jì)大獎"};
// for (int i = 0; i < source.length; i++) {
// SegResult sr = seg.split(source[i]);
// System.out.println("time:" + sr.getSpendTime() + " " +
// sr.getFinalResult());
// }
// try {
// int count = 0;
// long times = 0;
// long bytes = 0;
// int segPathCount = 1;
// int forCount = 1;
// seg.setSegPathCount(segPathCount);
// ArrayList<String> testCases = GFString.readTxtFile2("test\\case1.txt");
// for (int i = 0; i < forCount; i++) {
// for (String src : testCases) {
// SegResult sr = SegMain.seg.split(src);
// count++;
// bytes += src.getBytes().length;
// times += sr.getSpendTime();
// logger.info("[time:" + sr.getSpendTime() + "ms]:\n" + sr.getFinalResult());
// }
// logger.info("i:"+i+"\ntotal_count:" + count + "\ntotal_time:" + times + "\ntotal_bytes:" + bytes + "\navg_time:"
// + (times / count) + "\navg_bytes:" + (bytes / times) + "b/ms");
// }
// } catch (IOException e1) {
// e1.printStackTrace();
// }
}
private void initFrm() {
FrmMain frm = FrmMain.getInstance();
JFrame jf = frm.getJFrame();
jf.setSize(800, 600);
jf.setVisible(true);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -