| 7 | import com.baidu.nlp.LAC; |
| 8 | |
| 9 | public class LacMulti { |
| 10 | static { |
| 11 | // 装载LAC链接库,需要lacjni的链接库文件放到当前目录下 |
| 12 | // System.setProperty("java.library.path", "."); |
| 13 | System.loadLibrary("lacjni"); |
| 14 | } |
| 15 | |
| 16 | public static void main(String[] args) { |
| 17 | |
| 18 | // 默认模型路径 |
| 19 | String model_path = new String("./lac_model"); |
| 20 | if (args.length < 2){ |
| 21 | System.out.println("Usage: "+argv[0]+ " + model_dir + thread_num"); |
| 22 | System.exit(1); |
| 23 | } |
| 24 | |
| 25 | model_path = args[0]; |
| 26 | int thread_num = Integer.parseInt(args[1]); |
| 27 | |
| 28 | LAC lac = new LAC(model_path); |
| 29 | LacRunnable lacrunner = new LacRunnable(lac); |
| 30 | |
| 31 | Thread threads[]=new Thread[thread_num]; |
| 32 | for (int i = 0; i< thread_num; i++){ |
| 33 | threads[i] = new Thread(lacrunner); |
| 34 | threads[i].start(); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | } |
| 39 | |
| 40 | class LacRunnable implements Runnable{ |
| 41 |
nothing calls this directly
no outgoing calls
no test coverage detected