node
autocorpus.ac_bioc.node
¤
This module defines the BioCNode class.
Classes¤
BioCNode(refid=str(), role=str())
dataclass
¤
Represents a node in a BioC graph with a reference ID and a role.
Functions¤
from_dict(data)
classmethod
¤
Create a BioCNode instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, str]
|
A dictionary containing 'refid' and 'role' keys. |
required |
Returns:
Name | Type | Description |
---|---|---|
BioCNode |
BioCNode
|
An instance of BioCNode initialized with the provided data. |
Source code in autocorpus/ac_bioc/node.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
from_xml(elem)
classmethod
¤
Create a BioCNode instance from an XML element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elem
|
Element
|
An XML element containing 'refid' and 'role' attributes. |
required |
Returns:
Name | Type | Description |
---|---|---|
BioCNode |
BioCNode
|
An instance of BioCNode initialized with the provided XML data. |
Source code in autocorpus/ac_bioc/node.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
to_xml()
¤
Convert the BioCNode instance to an XML element.
Returns:
Type | Description |
---|---|
Element
|
ET.Element: An XML element representing the BioCNode instance. |
Source code in autocorpus/ac_bioc/node.py
36 37 38 39 40 41 42 43 44 45 |
|