@@ -93,10 +93,14 @@ def to_common(self) -> Line:
93
93
return Line (points = [Point (x = pt .x , y = pt .y ) for pt in self .line ])
94
94
95
95
@classmethod
96
- def from_common (cls , line : Line ,
97
- classifications : List [ClassificationAnnotation ], name : str ,
98
- feature_schema_id : Cuid , extra : Dict [str , Any ],
99
- data : Union [ImageData , TextData ]) -> "NDLine" :
96
+ def from_common (cls ,
97
+ line : Line ,
98
+ classifications : List [ClassificationAnnotation ],
99
+ name : str ,
100
+ feature_schema_id : Cuid ,
101
+ extra : Dict [str , Any ],
102
+ data : Union [ImageData , TextData ],
103
+ confidence : Optional [float ] = None ) -> "NDLine" :
100
104
return cls (line = [{
101
105
'x' : pt .x ,
102
106
'y' : pt .y
@@ -105,7 +109,8 @@ def from_common(cls, line: Line,
105
109
name = name ,
106
110
schema_id = feature_schema_id ,
107
111
uuid = extra .get ('uuid' ),
108
- classifications = classifications )
112
+ classifications = classifications ,
113
+ confidence = confidence )
109
114
110
115
111
116
class NDFrameLine (VideoSupported ):
@@ -340,7 +345,7 @@ class Location(BaseModel):
340
345
end : int
341
346
342
347
343
- class NDTextEntity (NDBaseObject ):
348
+ class NDTextEntity (NDBaseObject , ConfidenceMixin ):
344
349
location : Location
345
350
346
351
def to_common (self ) -> TextEntity :
@@ -350,7 +355,8 @@ def to_common(self) -> TextEntity:
350
355
def from_common (cls , text_entity : TextEntity ,
351
356
classifications : List [ClassificationAnnotation ], name : str ,
352
357
feature_schema_id : Cuid , extra : Dict [str , Any ],
353
- data : Union [ImageData , TextData ]) -> "NDTextEntity" :
358
+ data : Union [ImageData ,
359
+ TextData ], confidence : float ) -> "NDTextEntity" :
354
360
return cls (location = Location (
355
361
start = text_entity .start ,
356
362
end = text_entity .end ,
@@ -359,7 +365,8 @@ def from_common(cls, text_entity: TextEntity,
359
365
name = name ,
360
366
schema_id = feature_schema_id ,
361
367
uuid = extra .get ('uuid' ),
362
- classifications = classifications )
368
+ classifications = classifications ,
369
+ confidence = confidence )
363
370
364
371
365
372
class NDObject :
0 commit comments