Skip to content

bioctable

autocorpus.ac_bioc.bioctable ¤

BioCTable Package.

This package provides classes for handling modified BioC table structures, including cells, collections, documents, JSON encoding, and passages.

Classes¤

BioCTableCell(cell_id=str(), cell_text=str()) dataclass ¤

Represents a cell in a table.

BioCTableCollection(source=str(), date=str(), key=str(), documents=list(), infons=dict()) dataclass ¤

Bases: BioCCollection

A collection of BioCTableDocument objects extending BioCCollection.

BioCTableDocument(id=str(), inputfile=str(), infons=dict(), passages=list(), relations=list(), annotations=list()) dataclass ¤

Bases: BioCDocument

Extends BioCDocument to include BioCTablePassage objects.

BioCTableJSON ¤

Utility class for serializing BioCTableCollection objects to JSON.

Functions¤
dump(obj, fp, **kwargs) staticmethod ¤

Serialize a BioCTableCollection object to a JSON file-like object.

Parameters:

Name Type Description Default
obj

object The object to serialize.

required
fp

file-like object The file-like object to write the JSON data to.

required
**kwargs

dict Additional keyword arguments to pass to json.dump.

{}
Source code in autocorpus/ac_bioc/bioctable/json.py
82
83
84
85
86
87
88
89
90
91
92
93
94
@staticmethod
def dump(obj, fp, **kwargs):
    """Serialize a BioCTableCollection object to a JSON file-like object.

    Parameters:
        obj : object
            The object to serialize.
        fp : file-like object
            The file-like object to write the JSON data to.
        **kwargs : dict
            Additional keyword arguments to pass to `json.dump`.
    """
    return json.dump(obj, fp, cls=BioCTableJSONEncoder, **kwargs)
dumps(obj, **kwargs) staticmethod ¤

Serialize a BioCTableCollection object to a JSON-formatted string.

Parameters:

Name Type Description Default
obj

object The object to serialize.

required
**kwargs

dict Additional keyword arguments to pass to json.dumps.

{}

Returns:

Type Description

str A JSON-formatted string representation of the object.

Source code in autocorpus/ac_bioc/bioctable/json.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
@staticmethod
def dumps(obj, **kwargs):
    """Serialize a BioCTableCollection object to a JSON-formatted string.

    Parameters:
        obj : object
            The object to serialize.
        **kwargs : dict
            Additional keyword arguments to pass to `json.dumps`.

    Returns:
        str
            A JSON-formatted string representation of the object.
    """
    return json.dumps(obj, cls=BioCTableJSONEncoder, **kwargs)

BioCTablePassage(text=str(), offset=int(), infons=dict(), sentences=list(), annotations=list(), relations=list(), column_headings=list(), data_section=list()) dataclass ¤

Bases: BioCPassage

A class that extends BioCPassage to handle table data.