| 3 | import java.util.ArrayList; |
| 4 | |
| 5 | public class LAC { |
| 6 | |
| 7 | // as c++ self pointer |
| 8 | private long self_ptr; |
| 9 | |
| 10 | public LAC(String model_dir) { |
| 11 | init(model_dir); |
| 12 | } |
| 13 | |
| 14 | public LAC(LAC model){ |
| 15 | copy(model.self_ptr); |
| 16 | } |
| 17 | |
| 18 | @Override |
| 19 | protected void finalize() throws Throwable { |
| 20 | close(); |
| 21 | super.finalize(); |
| 22 | } |
| 23 | |
| 24 | public void close() { |
| 25 | if(self_ptr != 0) { |
| 26 | release(self_ptr); |
| 27 | self_ptr = 0; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | // load model from model_path |
| 32 | private native void init(String model_path); |
| 33 | |
| 34 | // load model from existing model's self_ptr |
| 35 | private native void copy(long self_ptr); |
| 36 | |
| 37 | // release lac model |
| 38 | private static native void release(long self_ptr); |
| 39 | |
| 40 | // load dict from dict_path |
| 41 | public native int loadCustomization(String dict_path); |
| 42 | |
| 43 | // run lac, results save in words and tags |
| 44 | public native int run(String sentence, ArrayList<String> words, ArrayList<String> tags); |
| 45 | |
| 46 | } |
nothing calls this directly
no outgoing calls
no test coverage detected