CogComp / cogcomp-nlpy

CogComp's light-weight Python NLP annotators
http://nlp.cogcomp.org/
Other
116 stars 26 forks source link

Local_PIpeline: why protobuff? #89

Closed danyaljj closed 6 years ago

danyaljj commented 6 years ago

@GHLgh @bhargav you guys remember why we are writing the output of the remote server into a proobuff file and then read it again? (instead of just returning the json output of the server). https://github.com/CogComp/cogcomp-nlpy/blob/master/ccg_nlpy/local_pipeline.py#L70-L77

I have one guess, but I am not sure if it is correct: it is possible that we are not able to read the output of the java code directly, so we have to write it on disk, and read it again. Is that correct?

GHLgh commented 6 years ago

Actually the Python side can read the JSON serialization from Java code, but you are right that Protobuf was used for cross-platform purpose.

For this particular part, I found the conversation in #47: SerializatuinHelper will print the JSON result, so there will be redundant output. It would be faster to call serializeToJson directly but not user-friendly.

bhargav commented 6 years ago

Yeah. We added ProtoBuf support to be able to read/write serialized versions stored on disk from both Java code and Python code consistently.

But as @GHLgh pointed out, we should be able to parse the JSON returned by the server.