File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class ListFieldV1:
2828 """Confidence score"""
2929 reconstructed : bool
3030 """Whether the field was reconstructed from other fields."""
31- page_id : int
31+ page_id : Optional [ int ]
3232 """The document page on which the information was found."""
3333 values : List [ListFieldValueV1 ]
3434 """List of word values"""
@@ -41,15 +41,19 @@ def __init__(
4141 ) -> None :
4242 self .values = []
4343 self .reconstructed = reconstructed
44+
45+ for value in raw_prediction ["values" ]:
46+ self .values .append (ListFieldValueV1 (value ))
47+ if "page_id" in value :
48+ page_id = value ["page_id" ]
49+
4450 if page_id is None :
45- self .page_id = raw_prediction ["page_id" ]
51+ if "page_id" in raw_prediction :
52+ self .page_id = raw_prediction ["page_id" ]
4653 else :
4754 self .page_id = page_id
4855 self .confidence = raw_prediction ["confidence" ]
4956
50- for value in raw_prediction ["values" ]:
51- self .values .append (ListFieldValueV1 (value ))
52-
5357 @property
5458 def contents_list (self ) -> List [str ]:
5559 """Return a List of the contents of all values."""
You can’t perform that action at this time.
0 commit comments