@@ -19,7 +19,8 @@ class Word(BaseModel):
1919 polygon : Optional [List [float ]] = None
2020
2121 @field_validator ("polygon" , mode = "after" )
22- def parse_polygon (self , value , info : ValidationInfo ):
22+ @classmethod
23+ def parse_polygon (cls , value , info : ValidationInfo ):
2324 """
2425 Providing comparability with Azure Documenent Document Intelligence Service API result.
2526
@@ -51,7 +52,8 @@ class Line(BaseModel):
5152 polygon : Optional [List [float ]] = None
5253
5354 @field_validator ("polygon" , mode = "after" )
54- def parse_polygon (self , value , info : ValidationInfo ):
55+ @classmethod
56+ def parse_polygon (cls , value , info : ValidationInfo ):
5557 source_str = info .data .get ("source" , "" )
5658 if source_str .startswith ("D(" ) and source_str .endswith (")" ):
5759 inside = source_str [2 :- 1 ] # remove "D(" and ")"
@@ -73,7 +75,8 @@ class Paragraph(BaseModel):
7375 polygon : Optional [List [float ]] = None
7476
7577 @field_validator ("polygon" , mode = "after" )
76- def parse_polygon (self , value , info : ValidationInfo ):
78+ @classmethod
79+ def parse_polygon (cls , value , info : ValidationInfo ):
7780 source_str = info .data .get ("source" , "" )
7881 if source_str .startswith ("D(" ) and source_str .endswith (")" ):
7982 inside = source_str [2 :- 1 ] # remove "D(" and ")"
0 commit comments