MCPcopy Create free account
hub / github.com/baidu/lac / LAC

Class LAC

java/com/baidu/nlp/LAC.java:5–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import java.util.ArrayList;
4
5public 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected