I'm trying to write an plugin in for ES but I keep getting this annoying error whenever I try it and I don't know what's causing it. Below is the class that appears in the errors:
public class SentimentAnalyzer {
GoSentiment gs;
Map<Integer, String> lookup;
public interface GoSentiment extends Library {
class GoString extends Structure {
public static class ByValue extends GoString implements Structure.ByValue {}
public String p;
public long n;
protected List<String> getFieldOrder(){
return Arrays.asList(new String[]{"p","n"});
}
}
int ClassifySentiment(GoString.ByValue str);
}
public SentimentAnalyzer(){
String path = "/usr/share/elasticsearch/config/ingest-opennlp/sentiment.so";
gs = Native.loadLibrary(path, GoSentiment.class);
lookup = new HashMap<>();
lookup.put(0, "negative");
lookup.put(1, "positive");
}
public int analyzeSentiment(String text){
GoSentiment.GoString.ByValue str = new GoSentiment.GoString.ByValue();
str.p = text;
str.n = text.length();
return gs.ClassifySentiment(str);
}
public String toSentimentWord(int value){
if(lookup.containsKey(value)){
return lookup.get(value);
}
return "null";
}
}
Specifically, the error points to the GoString
class declaration. What is happening here?