Skip to content

TypeError: Couldn't build proto file into descriptor pool! #5

@XiaohanYa

Description

@XiaohanYa

Hi,

I'm using CoreNLP Client from stanza to annotate my text, and I want to save my results. I used the following code to save my results. I think it works well but I encountered errors when reading in the result file.

with open(dir_path+'reproduced/corenlp/results.pb2', 'wb') as f:
    f.write(annotated_doc.SerializeToString())

When reading the file, I tried the following code. The corenlp-protobuf I installed is version 3.8.0.

from corenlp_protobuf import Document, parseFromDelimitedString

def readCoreNLPProtoFile(protoFile):
  with open('protoFile', 'rb') as f:
      buf = f.read()
  doc = Document()
  parseFromDelimitedString(doc, buf)
  return doc

However, I got the TypeError as follows. Could someone help me? Thanks in advance.

Screen Shot 2021-11-09 at 10 01 08 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions