Reputation: 143
I've been encountering this error:
I ran the OpenIE 4.1 binary but got the following error:
Exception in thread "main" java.lang.NullPointerException at
com.googlecode.clearnlp.tokenization.EnglishTokenizer.protectEmoticons
(EnglishTokenizer.java:335) at
com.googlecode.clearnlp.tokenization.EnglishTokenizer.getTokenList(En
glishTokenizer.java:109) at
com.googlecode.clearnlp.tokenization.AbstractTokenizer.getTokens(AbstractTokenizer.java:58) at
edu.knowitall.tool.tokenize.ClearTokenizer.tokenize(ClearTokenizer.sc ala:22)
I've looked up a few sources and found a comment by Yangrui who also had this problem in the past. But there are no solutions. I've checked my openie.4.1.jar file and the com.googlecode.clearnlp.tokenization.EnglishTokenizer.protectEmoticon exists.
Hope someone can help shed some light on this. Thank you in advance.
Upvotes: 1
Views: 109
Reputation: 143
I've managed to solve this error. The issue lies with the compilation of the OpenIE 4.0 JAR and OpenIE 4.1 JAR files I downloaded from the official website. (http://knowitall.github.io/openie/).
How to solve? Compile the classes yourself.
Note: There could be some changes you need to make to your code if you are running OpenIE as a dependency. The code for test is as follows:
OpenIE openIE = new OpenIE(new ClearParser(new ClearPostagger(new ClearTokenizer())), new ClearSrl(), false, false);
Seq<Instance> extractions = openIE.extract("Obama is the president of the United States");
Iterator<Instance> iterator = extractions.iterator();
while (iterator.hasNext()) {
Instance inst = iterator.next();
StringBuilder sb = new StringBuilder();
sb.append(inst.confidence()).append("\t\t")
.append(inst.extr().arg1().text()).append("\t\t")
.append(inst.extr().rel().text()).append("\t\t");
Iterator<Argument> argIter = inst.extr().arg2s().iterator();
while (argIter.hasNext()) {
Part arg = argIter.next();
sb.append(arg.text()).append("; ");
}
System.out.println(sb.toString());
}
I hope this will help someone in the future.
Upvotes: 1