pub fn parse_decomp(json: &Value) -> Result<Schema, ProtocolError>Expand description
Parse a JSON-serialised UDS graph into a Schema.
The expected JSON layout mirrors the Decomp toolkit’s serialisation:
{
"corpus_id": "ewt",
"documents": {
"doc-1": {
"sentences": {
"sent-1": {
"syntax": {
"tokens": {
"1": {"form":"The","lemma":"the","upos":"DET","xpos":"DT","deprel":"det"}
}
},
"semantics": {
"predicates": {
"pred-1-1": {
"domain": "semantics", "type": "predicate",
"frompredpatt": true,
"head_token": "1", "span_tokens": ["1"],
"factuality": {"factual": {"value": 0.9, "confidence": 1.0}},
"genericity": {"pred-particular": {"value": 0.8, "confidence": 1.0}},
"time": {"dur-seconds": {"value": 0.1, "confidence": 0.5}},
"event_structure": {"telic": {"value": 0.7, "confidence": 1.0}}
}
},
"arguments": {
"arg-1-1": {
"domain": "semantics", "type": "argument",
"head_token": "2", "span_tokens": ["2"],
"genericity": {"arg-particular": {"value": 0.9, "confidence": 1.0}},
"wordsense": {"supersense-noun.person": {"value": 0.8, "confidence": 1.0}}
}
},
"edges": {
"pred-1-1$$arg-1-1": {
"protoroles": {"awareness": {"value": 0.9, "confidence": 1.0}}
}
}
}
}
}
}
}
}§Errors
Returns ProtocolError if the JSON structure cannot be parsed.