0

I have a Document.proto file.

I have a .pb file which looks like this:

Ü
&/guid/9202a8c04000641f8000000003221072&/guid/9202a8c04000641f80000000004cfd50NA"Ö

S/m/vinci8/data1/riedel/projects/relation/kb/nyt1/docstore/2007-joint/1850511.xml.pb„€€€øÿÿÿÿƒ€€€øÿÿÿÿ"PERSON->PERSON"'inverse_false|PERSON|on bass and|PERSON"/inverse_false|with|PERSON|on bass and|PERSON|on"7inverse_false|, with|PERSON|on bass and|PERSON|on drums"$inverse_false|PERSON|IN NN CC|PERSON",inverse_false|with|PERSON|IN NN CC|PERSON|on"4inverse_false|, with|PERSON|IN NN CC|PERSON|on drums"`str:Dave[NMOD]->|PERSON|[PMOD]->with[ADV]->was[ROOT]<-on[PRD]<-bass[PMOD]<-|PERSON|[NMOD]->Barry"]str:Dave[NMOD]->|PERSON|[PMOD]->with[ADV]->was[ROOT]<-on[PRD]<-bass[PMOD]<-|PERSON|[NMOD]->on"Rstr:Dave[NMOD]->|PERSON|[PMOD]->with[ADV]->was[ROOT]<-on[PRD]<-bass[PMOD]<-|PERSON"Adep:[NMOD]->|PERSON|[PMOD]->[ADV]->[ROOT]<-[PRD]<-[PMOD]<-|PERSON"dir:->|PERSON|->-><-<-<-|PERSON"Sstr:PERSON|[PMOD]->with[ADV]->was[ROOT]<-on[PRD]<-bass[PMOD]<-|PERSON|[NMOD]->Barry"Adep:PERSON|[PMOD]->[ADV]->[ROOT]<-[PRD]<-[PMOD]<-|PERSON|[NMOD]->"dir:PERSON|->-><-<-<-|PERSON|->"Pstr:PERSON|[PMOD]->with[ADV]->was[ROOT]<-on[PRD]<-bass[PMOD]<-|PERSON|[NMOD]->on"Adep:PERSON|[PMOD]->[ADV]->[ROOT]<-[PRD]<-[PMOD]<-|PERSON|[NMOD]->"dir:PERSON|->-><-<-<-|PERSON|->"Estr:PERSON|[PMOD]->with[ADV]->was[ROOT]<-on[PRD]<-bass[PMOD]<-|PERSON*ŒThe occasion was suitably exceptional : a reunion of the 1970s-era Sam Rivers Trio , with Dave Holland on bass and Barry Altschul on drums ."¬

My idea is that when I decode it, it should looks something like this:

        <Doc>
            <DocNo>1~1</DocNo>
            <FileName>/m/vinci8/data1/riedel/projects/relation/kb/nyt1/docstore/2007-joint/1849689.xml.pb</FileName>
            <Sentence>Tonight he brings his energies and expertise to the Miller Theater for the festival 's thrilling finale : a reunion of the 1970s Sam Rivers Trio , with Dave Holland on bass and Barry Altschul on drums .</Sentence>
            <SourceNE>PERSON</SourceNE>
            <DestNE>PERSON</DestNE>
            <SourceId>-2147483642</SourceId>
            <DestId>-2147483643</DestId>
            <Features>
            <![CDATA[
                <Feature>PERSON->PERSON</Feature>
                <Feature>inverse_false|PERSON|on bass and|PERSON</Feature>
                <Feature>inverse_false|with|PERSON|on bass and|PERSON|on</Feature>
                <Feature>inverse_false|, with|PERSON|on bass and|PERSON|on drums</Feature>
                <Feature>inverse_false|PERSON|IN NN CC|PERSON</Feature>
                <Feature>inverse_false|with|PERSON|IN NN CC|PERSON|on</Feature>
                <Feature>inverse_false|, with|PERSON|IN NN CC|PERSON|on drums</Feature>
                <Feature>str:Dave[NMOD]->|PERSON|[PMOD]->with[NMOD]->Trio[NULL]<-on[NMOD]<-bass[PMOD]<-|PERSON|[NMOD]->Barry</Feature>
                <Feature>str:Dave[NMOD]->|PERSON|[PMOD]->with[NMOD]->Trio[NULL]<-on[NMOD]<-bass[PMOD]<-|PERSON|[NMOD]->on</Feature>
                <Feature>str:Dave[NMOD]->|PERSON|[PMOD]->with[NMOD]->Trio[NULL]<-on[NMOD]<-bass[PMOD]<-|PERSON</Feature>
                <Feature>dep:[NMOD]->|PERSON|[PMOD]->[NMOD]->[NULL]<-[NMOD]<-[PMOD]<-|PERSON</Feature>
                <Feature>dir:->|PERSON|->-><-<-<-|PERSON</Feature>
                <Feature>str:PERSON|[PMOD]->with[NMOD]->Trio[NULL]<-on[NMOD]<-bass[PMOD]<-|PERSON|[NMOD]->Barry</Feature>
                <Feature>dep:PERSON|[PMOD]->[NMOD]->[NULL]<-[NMOD]<-[PMOD]<-|PERSON|[NMOD]-></Feature>
                <Feature>dir:PERSON|->-><-<-<-|PERSON|-></Feature>
                <Feature>str:PERSON|[PMOD]->with[NMOD]->Trio[NULL]<-on[NMOD]<-bass[PMOD]<-|PERSON|[NMOD]->on</Feature>
                <Feature>dep:PERSON|[PMOD]->[NMOD]->[NULL]<-[NMOD]<-[PMOD]<-|PERSON|[NMOD]-></Feature>
                <Feature>dir:PERSON|->-><-<-<-|PERSON|-></Feature>
                <Feature>str:PERSON|[PMOD]->with[NMOD]->Trio[NULL]<-on[NMOD]<-bass[PMOD]<-|PERSON</Feature>
            ]]>
            </Features>
        </Doc>
    </Docs>

But also I want to then change that block of code directly above these words (actually the whole larger file of which it is only a small component) into a .pb file, run it through the system and see if I get the same out put as the .pb file I recently decoded.

How to accomplish this?

From what I've been reading it seems as though I have to write a small .java program to decode everything, and then maybe I can encode the other by just using the protoc? or do a have to write a small program for that too?

If you are interested in genuinly helping me please try to explain in words and not just post a link to the documentation, like they did in this question.

Community
  • 1
  • 1
smatthewenglish
  • 2,831
  • 4
  • 36
  • 72
  • Where do you get problems with? First you need to create the interface classes for the protocoll buffer. Then you need to create a Java application which decodes your `*.pb` and returns an object tree. With that object tree you are able to build your XML like structure. – SubOptimal Apr 08 '15 at 07:00
  • 1
    Only for the record: The solution has been posted here https://stackoverflow.com/questions/29531899/how-to-write-a-valid-decoding-file-based-on-a-given-proto-reading-from-a-pb – SubOptimal Apr 09 '15 at 12:10

0 Answers0