org.apache.thrift.TApplicationException: Internal error processing get_entities_from_text #22
Comments
Closing as duplicate of #14. |
I'm reopening this as this seems to be an issue with named entity recognition and not with the parser, which was the case with #14. Or am I wrong? @Vanaja1505 is there anything more to that error message? Can you share with me your client code? Thanks. |
Thanks for your response! Below is the issue am getting: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
org.apache.thrift.TApplicationException: Internal error processing parse_text
at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
at CoreNLP.StanfordCoreNLP$Client.recv_parse_text(Unknown Source)
at CoreNLP.StanfordCoreNLP$Client.parse_text(Unknown Source)
at StanfordCoreNLPClient.perform(StanfordCoreNLPClient.java:59)
at StanfordCoreNLPClient.main(StanfordCoreNLPClient.java:42)` And my client code is: import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import CoreNLP.ParseTree;
import CoreNLP.StanfordCoreNLP;
public class StanfordCoreNLPClient {
public static void main(String [] args) {
String server = "";
Integer port = 0;
String inputFilename = "";
if (args.length == 3) {
server = args[0];
port = Integer.parseInt(args[1]);
inputFilename = args[2];
}
else {
System.err.println("Usage: StanfordCoreNLPClient <server> <port> <inputfile>");
System.exit(2);
}
try {
TTransport transport;
transport = new TSocket(server, port);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
StanfordCoreNLP.Client client = new StanfordCoreNLP.Client(protocol);
perform(client, inputFilename);
transport.close();
} catch (TException x) {
x.printStackTrace();
}
}
private static void perform(StanfordCoreNLP.Client client, String inputFilename) throws TException
{
FileReader infile = null;
try {
infile = new FileReader(inputFilename);
BufferedReader in = new BufferedReader(infile);
while (in.ready()) {
String sentence = in.readLine();
List<ParseTree> trees = client.parse_text(sentence, null);
for (ParseTree tree : trees)
{
System.out.println(tree.tree);
}
/* StanfordTokenizerThrift a= new StanfordTokenizerThrift();
List<List<String>> st = a.tokenizeText(sentence);
for(int i=0;i<st.size()-1;i++){
List<String> st1 = st.get(i);
for(int j=0;j<st1.size();j++){
System.out.println("--"+st1.get(j));
}
}*/
}
in.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
} Note: |
Got it. Thanks for sharing your client code. 😄
String[] desiredOutputFormat = {"-outputFormat", "oneline"};
List<ParseTree> trees = client.parse_text(sentence, desiredOutputFormat);
Thanks! |
Oh, hello. |
Nice, maybe my problem is then fixed too. |
I think so! Definitely re-open if you find this to not be the case. 😄 |
Thanks for your valuable response! Now it works without any error. But now the memory usage of Server is increasing as we use continuously... Do you have any solution to this? If yes can you please share it?? |
Hmmm, interesting...I'm going to create a new issue for that. |
Hi,
I got the below exception when executing Client script. However the server is running good.
org.apache.thrift.TApplicationException: Internal error processing get_entities_from_text
Any help appreciated!
Regards,
Vanaja Jayaraman
The text was updated successfully, but these errors were encountered: