from_json¶
-
ucca.convert.
from_json
(lines, *args, skip_category_mapping=False, by_external_id=False, **kwargs)[source]¶ - Convert text (or dict) in UCCA-App JSON format to a Passage object.
- According to the API, annotation units are organized in a tree, where the full unit is included as a child of
- its parent: https://github.com/omriabnd/UCCA-App/blob/master/UCCAApp_REST_API_Reference.pdf Token children are included in full in the “children_tokens” field. Note: children_tokens contains all tokens that are descendants of the unit, not just immediate children.
- tree_id: encodes the path leading to the node, e.g., 3-5-2.
- 1-based, and in reverse order to the children’s appearance, so that 1 is last, 2 is before last, etc. The exception is the first level, where there is just 0, and the next level starts from 1 (not 0-1).
parent_tree_id: the tree_id of the node’s parent, where 0 is the root
Parameters: - lines – iterable of lines in JSON format, describing a single passage.
- skip_category_mapping – if False, translate category names to edge tag abbreviations; if True, don’t
- by_external_id – set passage ID to be the external ID of the source passage rather than its ID
Returns: generator of Passage objects