I am trying to get a dependency tree in JSON format from SyntaxNet but all I get from the examples is a Sentence Object which is providing no accessors to access the parsed object or even iterate through the items listed.
When I run the examples from the docker file provided by TensorFlow/SyntaxNet, what I get is as below
text: "Alex saw Bob"
token {
word: "Alex"
start: 0
end: 3
head: 1
tag: "attribute { name: \"Number\" value: \"Sing\" } attribute { name: \"fPOS\" value: \"PROPN++NNP\" } "
category: ""
label: "nsubj"
break_level: NO_BREAK
}
token {
word: "saw"
start: 5
end: 7
tag: "attribute { name: \"Mood\" value: \"Ind\" } attribute { name: \"Tense\" value: \"Past\" } attribute { name: \"VerbForm\" value: \"Fin\" } attribute { name: \"fPOS\" value: \"VERB++VBD\" } "
category: ""
label: "root"
break_level: SPACE_BREAK
}
token {
word: "Bob"
start: 9
end: 11
head: 1
tag: "attribute { name: \"Number\" value: \"Sing\" } attribute { name: \"fPOS\" value: \"PROPN++NNP\" } "
category: ""
label: "parataxis"
break_level: SPACE_BREAK
}
The class type of this object is class 'syntaxnet.sentence_pb2.Sentence' which in it self does not have any documentation.
I need to be able to access the above output programmatically.
As seen in this question, It prints a table in string format and does not give me a programmatic response.
How can i get the response and not a print output. or should i write a parser for this output..?