File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
labelbox/data/annotation_types Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 1- from typing import Dict , Any
1+ from typing import Dict , Any , List
22
3- from pydantic import BaseModel , root_validator
3+ from pydantic import BaseModel , root_validator , validator
44
55
66class TextEntity (BaseModel ):
@@ -17,3 +17,20 @@ def validate_start_end(cls, values):
1717 raise ValueError (
1818 "Location end must be greater or equal to start" )
1919 return values
20+
21+
22+ class DocumentTextSelection (BaseModel ):
23+ tokenIds : List [str ]
24+ groupId : str
25+ page : int
26+
27+ @validator ("page" )
28+ def validate_page (cls , v ):
29+ if v < 1 :
30+ raise ValueError ("Page must be greater than 1" )
31+ return v
32+
33+ class DocumentEntity (BaseModel ):
34+ """ Represents a text entity """
35+ name : str
36+ text_selections : List [DocumentTextSelection ]
You can’t perform that action at this time.
0 commit comments