ó
    gÁ.jh  ã                  óv  • % S r SSKJr  SSKJr  SSKJrJrJr  SSK	r	SS/SS	// S
/S/S/S// S.r
S\S'   SrSr        S!S jrS"S jr\S:X  ah  \" \" S5      \
5      r\" \5       HL  r\" S\ S\" \\   5       S35        \\    H(  r\" S\S   S S\S   S S\S   S S\S   S S 3	5        M*     MN     gg)#u…  Ground-truth table regions for the QUE-245 spike.

A table's region is its FULL anatomy: title/caption + units line + every
column-header row (including multi-level/spanning headers) + the row-label
(stub) column + all body/subtotal/total rows + any footnotes attached to
the table. Free-standing prose, page headers/footers (timestamp, URL, page
number) are NOT part of any table.

Ground truth is expressed per page as a list of vertical bands in PDF
points (top-left origin). The box for a band is computed as the tight union
of every text-layer word whose vertical center falls inside the band â€” so
the left/right edges are the true label and number extents, not guesses.
This keeps the answer key reproducible and tied to the actual document,
while the human judgement (where each table starts/ends, how many) lives in
the band list. Bands were read off the text-layer dumps in inspect output.
é    )Úannotations)ÚPath)ÚDictÚListÚTupleN)g     `z@g     À@)g     ¨€@g     @„@)ç      S@g      i@)g     `j@g     Ðt@)r   g     0z@)r   g     à~@)r   g     0~@)r   g      †@)é   é   é   é   é   é   é   é   ú$Dict[int, List[Tuple[float, float]]]ÚBHE_991_BANDSg      >@g     À‡@c                ó  • U R                   R                  U R                   R                  pCU R                  S5       Vs/ s Hd  nXS   US   -   S-  s=::  a  U::  d  M  O  M!  [        US   US   -   S-  s=::  a  [
        ::  d  MD  O  MH  US   R                  5       (       d  Mb  UPMf     nnU(       d  g[        S U 5       5      n[        S U 5       5      n[        S	 U 5       5      n	[        S
 U 5       5      n
Xs-  X„-  X“-  X¤-  4$ s  snf )zATight normalized (0..1, top-left) word-union box within a y-band.Úwordsr	   r   g       @r   )ç        r   r   r   c              3  ó*   #   • U  H	  oS    v •  M     g7f)r   N© ©Ú.0Úss     Ú//home/mande/repo/quber/experiments/que245/gt.pyÚ	<genexpr>Ú box_from_band.<locals>.<genexpr>9   ó   é € Ðš3�aˆqŽTš3ùó   ‚c              3  ó*   #   • U  H	  oS    v •  M     g7f)r	   Nr   r   s     r   r   r   :   r   r   c              3  ó*   #   • U  H	  oS    v •  M     g7f)r
   Nr   r   s     r   r   r   ;   r   r   c              3  ó*   #   • U  H	  oS    v •  M     g7f)r   Nr   r   s     r   r   r   <   r   r   )	ÚrectÚwidthÚheightÚget_textÚFURNITURE_Y_TOPÚFURNITURE_Y_BOTTOMÚstripÚminÚmax)ÚpageÚy_topÚy_bottomÚwÚhÚwordÚselÚx0Úy0Úx1Úy1s              r   Úbox_from_bandr7   +   s  € ð �9‰9�?‰?˜DŸI™I×,Ñ,€qð —M‘M 'Ô*óâ*ˆDØ˜!‘W˜t A™wÑ&¨#Ñ-Õ9°Ñ9ó 	á9ñ 	ô   Q¡¨$¨q©'Ñ 1°SÑ8ÕNÔ<NÑNó 	ñ Oñ 	ð �‰G�M‰M�O÷	 	Ù*ð ð ö Ø#Ü	Ñ™3ÓÓ	€BÜ	Ñ™3ÓÓ	€BÜ	Ñ™3ÓÓ	€BÜ	Ñ™3ÓÓ	€BØ‰F�B‘F˜B™F B¡FÐ+Ð+ùòs#   ¿D
ÁD
Á#D
ÂD
Â
D
Â$D
c           
     óÚ   • [         R                  " [        U 5      5      n0 nUR                  5        H/  u  pEX$S-
     nU VVs/ s H  u  px[	        XgU5      PM     snnX4'   M1     U$ s  snnf )zAYield (page, [normalized boxes]) for every page in the band spec.r	   )ÚfitzÚopenÚstrÚitemsr7   )	ÚpdfÚbandsÚdocÚoutÚpnoÚblistr,   ÚaÚbs	            r   Úground_truthrE   @   sb   € ä
�)Š)”C˜“HÓ
€CØ>@€CØ—k‘k–m‰
ˆØ˜‘7‰|ˆÙ<AÔBºE±&°1”M $¨1Ö-¹EÒBˆ‹ñ $ð €Jùó Cs   ÁA'Ú__main__zdocuments/BHE_991.pdfzpage z: z tablesz   (z.3fÚ,r	   r
   r   Ú))r,   z	fitz.Pager-   Úfloatr.   rI   Úreturnz!Tuple[float, float, float, float])r=   r   r>   r   )Ú__doc__Ú
__future__r   Úpathlibr   Útypingr   r   r   r9   r   Ú__annotations__r'   r(   r7   rE   Ú__name__ÚgtÚsortedrA   ÚprintÚlenrD   r   ó    r   Ú<module>rV      s$  ðòõ" #å ß $Ñ $ã ð
 	˜Ð'Ø�~Ð&Ø	Ø€Ø€Ø€Ø€Ø	ñ	7€Ð3ó 	ð €ØÐ ð,Ø
ð,Ø!ð,Ø-2ð,à&ô,ô*ð ˆzÓÙ	‘dÐ2Ó3°]Ó	C€BÙ�bŽzˆÙ��c�U˜"™S  C¡›\˜N¨'Ð2Ô3Ø�C”ˆAÙ�D˜˜1™˜c˜
 ! A a¡D¨ :¨Q¨q°©t°C¨j¸¸!¸A¹$¸s¸À1ÐEÖFó ò ð rU   