#!/usr/bin/env python# -*- coding: utf-8; -*-# Copyright (c) 2021, 2022 Oracle and/or its affiliates.# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/fromdataclassesimportasdict,dataclassfromtypingimportAny,Tuple,Union,Dict,Listfromads.data_labeling.boundingboximportBoundingBoxItemfromads.data_labeling.nerimportNERItem
[docs]@dataclassclassRecord:"""Class representing Record. Attributes ---------- path: str File path. content: Any Content of the record. annotation: Union[Tuple, str, List[BoundingBoxItem], List[NERItem]] Annotation/label of the record. """path:str=""content:Any=Noneannotation:Union[Tuple,str,List[BoundingBoxItem],List[NERItem]]=None
[docs]defto_dict(self)->Dict:"""Convert the Record instance to a dictionary. Returns ------- Dict Dictionary representation of the Record instance. """returnasdict(self)
[docs]defto_tuple(self,)->Tuple[str,Any,Union[Tuple,str,List[BoundingBoxItem],List[NERItem]]]:"""Convert the Record instance to a tuple. Returns ------- Tuple Tuple representation of the Record instance. """return(self.path,self.content,self.annotation)