
    }-j                         d dl Z ddlmZmZmZmZ ddlmZmZ ddl	m
Z
 ddlmZ  e             g dZ G d	 d
e          Z G d de          ZdS )    N   )add_simple_inference_argsget_subcommand_argsperform_simple_inferencestr2bool   )PaddleXPipelineWrapperPipelineCLISubcommandExecutor)create_config_from_structure)apply_patches)PP-OCRv3PP-OCRv4PP-OCRv5c            !       x    e Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fd	Zed             Zddddddddddddddddddddddddddddddddd dZddddddddddddddddddddddddddddddddd dZd	 Ze	d
             Z
d Zd Z xZS )PPStructureV3NcD           	      `   |C$|Ct           vrt          d|C dt            d          t          t          d ||||f                    rV|B|CQ|                     |B|C          \  }E}F|E|F0t          dt          |B           dt          |C           d          |E}|F}n|B|Ct          j        dd	           t                      	                                }G||Gd
<   ||Gd<   |G
                    d           |G
                    d           |G| _         t                      j        di |D d S )NzInvalid OCR version: z. Supported values are .c                 
    | d u S N )ps    c/var/www/html/banglarbhumi/venv/lib/python3.11/site-packages/paddleocr/_pipelines/pp_structurev3.py<lambda>z(PPStructureV3.__init__.<locals>.<lambda>n   s
    !t)     z)No models are available for the language z and OCR version z^`lang` and `ocr_version` will be ignored when model names or model directories are not `None`.r   )
stackleveltext_detection_model_nametext_recognition_model_nameselfkwargsr   )_SUPPORTED_OCR_VERSIONS
ValueErrorallmap_get_ocr_model_namesreprwarningswarnlocalscopypop_paramssuper__init__)Ir   layout_detection_model_namelayout_detection_model_dirlayout_threshold
layout_nmslayout_unclip_ratiolayout_merge_bboxes_modechart_recognition_model_namechart_recognition_model_dirchart_recognition_batch_sizeregion_detection_model_nameregion_detection_model_dir#doc_orientation_classify_model_name"doc_orientation_classify_model_dirdoc_unwarping_model_namedoc_unwarping_model_dirr   text_detection_model_dirtext_det_limit_side_lentext_det_limit_typetext_det_threshtext_det_box_threshtext_det_unclip_ratiotextline_orientation_model_nametextline_orientation_model_dirtextline_orientation_batch_sizer   text_recognition_model_dirtext_recognition_batch_sizetext_rec_score_threshtable_classification_model_nametable_classification_model_dir,wired_table_structure_recognition_model_name+wired_table_structure_recognition_model_dir/wireless_table_structure_recognition_model_name.wireless_table_structure_recognition_model_dir&wired_table_cells_detection_model_name%wired_table_cells_detection_model_dir)wireless_table_cells_detection_model_name(wireless_table_cells_detection_model_dir%table_orientation_classify_model_name$table_orientation_classify_model_dirseal_text_detection_model_nameseal_text_detection_model_dirseal_det_limit_side_lenseal_det_limit_typeseal_det_threshseal_det_box_threshseal_det_unclip_ratio seal_text_recognition_model_nameseal_text_recognition_model_dir seal_text_recognition_batch_sizeseal_rec_score_threshformula_recognition_model_nameformula_recognition_model_dirformula_recognition_batch_sizeuse_doc_orientation_classifyuse_doc_unwarpinguse_textline_orientationuse_seal_recognitionuse_table_recognitionuse_formula_recognitionuse_chart_recognitionuse_region_detectionformat_block_contentmarkdown_ignore_labelslangocr_versionr   det_model_namerec_model_nameparams	__class__sI                                                                           r   r-   zPPStructureV3.__init__    s   N "{:Q'Q'QfffLcfff   ##-,/.	 

 

 	 ;#:151J1J+2 2. ")^-C$uDJJuuaefqararuuu   -;).<+;#:t     .G*+0K,-

6

8""6"""""r   c                     dS )NzPP-StructureV3r   r   s    r   _paddlex_pipeline_namez$PPStructureV3._paddlex_pipeline_name       r   FT) rc   rd   re   rf   rg   rh   ri   rj   rk   r0   r1   r2   r3   r>   r?   r@   rA   rB   rH   rW   rX   rY   rZ   r[   r_   #use_wired_table_cells_trans_to_html&use_wireless_table_cells_trans_to_htmluse_table_orientation_classify use_ocr_results_with_table_cellsuse_e2e_wired_table_rec_model use_e2e_wireless_table_rec_modelrl   c                      | j         j        |fi d|d|d|d|d|d|d|d|	d	|
d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d| d |!|"S !Nrc   rd   re   rf   rg   rh   ri   rj   rk   r0   r1   r2   r3   r>   r?   r@   rA   rB   rH   rW   rX   rY   rZ   r[   r_   rw   rx   ry   rz   r{   r|   rl   )paddlex_pipelinepredict#r   inputrc   rd   re   rf   rg   rh   ri   rj   rk   r0   r1   r2   r3   r>   r?   r@   rA   rB   rH   rW   rX   rY   rZ   r[   r_   rw   rx   ry   rz   r{   r|   rl   r   s#                                      r   predict_iterzPPStructureV3.predict_iter   s   L -t$,#
 #
 #
)E)E#
 0/#
 &>%=	#

 "6!5#
 #8"7#
 %<$;#
 #8"7#
 "6!5#
 "6!5#
 .-#
 "z#
 !4 3#
 &>%=#
 %<$;#
  !4 3!#
" ,O##
$ !4 3%#
& #8"7'#
( #8"7)#
* %<$;+#
, !4 3-#
. ,O/#
0 !4 31#
2 #8"73#
4 #8"75#
6 1T0S7#
8 4Z3Y9#
: ,J+I;#
< .N-M=#
> +H*G?#
@ .N-MA#
B $:#9E#
 #
 #	
r   c                     t           | j        |fi d|d|d|d|d|d|d|d|	d	|
d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d| d |!|"          S r~   )listr   r   s#                                      r   r   zPPStructureV3.predict   s   L D# # #-I-I# #4"3# *B)A	#
 &:%9# '<&;# )@(?# '<&;# &:%9# &:%9# "2!1# &:# %8$7# *B)A# )@(?#  %8$7!#" !0##$ %8$7%#& '<&;'#( '<&;)#* )@(?+#, %8$7-#. !0/#0 %8$71#2 '<&;3#4 '<&;5#6 5X4W7#8 8^7]9#: 0N/M;#< 2R1Q=#> /L.K?#@ 2R1QA#B (>'=E# #%
 %
 %	
r   c                 6    | j                             |          S r   )r   concatenate_markdown_pages)r   markdown_lists     r   r   z(PPStructureV3.concatenate_markdown_pages,  s    $??NNNr   c                     t                      S r   )"PPStructureV3CLISubcommandExecutor)clss    r   get_cli_subcommand_executorz)PPStructureV3.get_cli_subcommand_executor/  s    1333r   c                    i d| j         d         d| j         d         d| j         d         p| j         d         d| j         d         d| j         d         d	| j         d	         d
| j         d
         d| j         d         d| j         d         d| j         d         d| j         d         d| j         d         d| j         d         d| j         d         d| j         d         d| j         d         d| j         d         i d| j         d         d| j         d         d| j         d          d!| j         d"         d#| j         d$         d%| j         d&         d'| j         d(         d)| j         d*         d+| j         d,         d-| j         d.         d/| j         d0         d1| j         d2         d3| j         d4         d5| j         d6         d7| j         d8         d9| j         d:         d;| j         d<         i d=| j         d>         d?| j         d@         dA| j         dB         dC| j         dD         dE| j         dF         dG| j         dH         dI| j         dJ         dK| j         dL         dM| j         dN         dO| j         dP         dQ| j         dR         dS| j         dT         dU| j         dV         dW| j         dX         dY| j         dZ         d[| j         d\         d]| j         d^         i d_| j         d`         da| j         d.         db| j         d0         dc| j         d2         dd| j         d4         de| j         d6         df| j         d8         dg| j         d:         dh| j         d<         di| j         d>         dj| j         d@         dk| j         dB         dl| j         dD         dm| j         dF         dn| j         dH         do| j         dp         dq| j         dr         | j         d2         | j         ds         | j         dt         | j         du         | j         dv         | j         dw         | j         dx         | j         dy         | j         dz         | j         d{         | j         d|         d}}t          |          S )~Nz9SubPipelines.DocPreprocessor.use_doc_orientation_classifyrc   z.SubPipelines.DocPreprocessor.use_doc_unwarpingrd   use_doc_preprocessorz0SubPipelines.GeneralOCR.use_textline_orientationre   rf   rg   rh   ri   rj   rk   rl   z%SubModules.LayoutDetection.model_namer.   z$SubModules.LayoutDetection.model_dirr/   z$SubModules.LayoutDetection.thresholdr0   z%SubModules.LayoutDetection.layout_nmsr1   z.SubModules.LayoutDetection.layout_unclip_ratior2   z3SubModules.LayoutDetection.layout_merge_bboxes_moder3   z&SubModules.ChartRecognition.model_namer4   z%SubModules.ChartRecognition.model_dirr5   z&SubModules.ChartRecognition.batch_sizer6   z%SubModules.RegionDetection.model_namer7   z$SubModules.RegionDetection.model_dirr8   zISubPipelines.DocPreprocessor.SubModules.DocOrientationClassify.model_namer9   zHSubPipelines.DocPreprocessor.SubModules.DocOrientationClassify.model_dirr:   z?SubPipelines.DocPreprocessor.SubModules.DocUnwarping.model_namer;   z>SubPipelines.DocPreprocessor.SubModules.DocUnwarping.model_dirr<   z;SubPipelines.GeneralOCR.SubModules.TextDetection.model_namer   z:SubPipelines.GeneralOCR.SubModules.TextDetection.model_dirr=   z?SubPipelines.GeneralOCR.SubModules.TextDetection.limit_side_lenr>   z;SubPipelines.GeneralOCR.SubModules.TextDetection.limit_typer?   z7SubPipelines.GeneralOCR.SubModules.TextDetection.threshr@   z;SubPipelines.GeneralOCR.SubModules.TextDetection.box_threshrA   z=SubPipelines.GeneralOCR.SubModules.TextDetection.unclip_ratiorB   zASubPipelines.GeneralOCR.SubModules.TextLineOrientation.model_namerC   z@SubPipelines.GeneralOCR.SubModules.TextLineOrientation.model_dirrD   zASubPipelines.GeneralOCR.SubModules.TextLineOrientation.batch_sizerE   z=SubPipelines.GeneralOCR.SubModules.TextRecognition.model_namer   z<SubPipelines.GeneralOCR.SubModules.TextRecognition.model_dirrF   z=SubPipelines.GeneralOCR.SubModules.TextRecognition.batch_sizerG   z?SubPipelines.GeneralOCR.SubModules.TextRecognition.score_threshrH   zGSubPipelines.TableRecognition.SubModules.TableClassification.model_namerI   zFSubPipelines.TableRecognition.SubModules.TableClassification.model_dirrJ   zRSubPipelines.TableRecognition.SubModules.WiredTableStructureRecognition.model_namerK   zQSubPipelines.TableRecognition.SubModules.WiredTableStructureRecognition.model_dirrL   zUSubPipelines.TableRecognition.SubModules.WirelessTableStructureRecognition.model_namerM   zTSubPipelines.TableRecognition.SubModules.WirelessTableStructureRecognition.model_dirrN   zLSubPipelines.TableRecognition.SubModules.WiredTableCellsDetection.model_namerO   zKSubPipelines.TableRecognition.SubModules.WiredTableCellsDetection.model_dirrP   zOSubPipelines.TableRecognition.SubModules.WirelessTableCellsDetection.model_namerQ   zNSubPipelines.TableRecognition.SubModules.WirelessTableCellsDetection.model_dirrR   zLSubPipelines.TableRecognition.SubModules.TableOrientationClassify.model_namerS   zKSubPipelines.TableRecognition.SubModules.TableOrientationClassify.model_dirrT   zYSubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextDetection.model_namezXSubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextDetection.model_dirz]SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextDetection.limit_side_lenzYSubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextDetection.limit_typezUSubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextDetection.threshzYSubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextDetection.box_threshz[SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextDetection.unclip_ratioz_SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextLineOrientation.model_namez^SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextLineOrientation.model_dirz_SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextLineOrientation.batch_sizez[SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextRecognition.model_namezZSubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextRecognition.model_dirz[SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextRecognition.batch_sizez]SubPipelines.TableRecognition.SubPipelines.GeneralOCR.SubModules.TextRecognition.score_threshzUSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextDetection.model_namerU   zTSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextDetection.model_dirrV   rX   rY   rZ   r[   r\   r]   r^   r`   ra   rb   )zYSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextDetection.limit_side_lenzUSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextDetection.limit_typezQSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextDetection.threshzUSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextDetection.box_threshzWSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextDetection.unclip_ratiozWSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextRecognition.model_namezVSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextRecognition.model_dirzWSubPipelines.SealRecognition.SubPipelines.SealOCR.SubModules.TextRecognition.batch_sizezHSubPipelines.FormulaRecognition.SubModules.FormulaRecognition.model_namezGSubPipelines.FormulaRecognition.SubModules.FormulaRecognition.model_dirzHSubPipelines.FormulaRecognition.SubModules.FormulaRecognition.batch_size)r+   r   )r   	STRUCTUREs     r   _get_paddlex_config_overridesz+PPStructureV3._get_paddlex_config_overrides3  sA   [
G.J[
 =dl#?	[
 #DL1O$P %1|/0[
 ?*A[
 #DL1G$H[
 $T\2I%J[
 &t|4M'N[
 $T\2I%J[
  #DL1G$H![
" #DL1G$H#[
$ %dl3K&L%[
& 4T\-6'[
, 3DL,5-[
2 3DLAS4T3[
4 4T\,5O5[
6 =dl%?7[
< B4<*D=[
 [
B 5dl.7C[
H 4T\-6I[
N 5dl.7O[
T 4T\-6U[
Z 3DL,5[[
` XY]Ye5Za[
f WX\Xd4Yg[
l Nt|*Pm[
r Mdl)Os[
x J4<+Ly[
~ I$,*K[
D Nt|)PE[
J J4<%LK[
P Ft|!HQ[
V J4<%LW[
\ LT\'N][
b PQUQ]1Rc[
 [
 [
h OPTP\0Qi[
n PQUQ]1Ro[
t LT\-Nu[
z KDL,M{[
@ LT\-NA[
F Nt|'PG[
L VW[Wc1XM[
R UVZVb0WS[
X abfbn>cY[
^ `aeam=b_[
d deieqAfe[
j cdhdp@ek[
p [\`\h8]q[
v Z[_[g7\w[
| ^_c_k;`}[
B ]^b^j:_C[
H [\`\h7]I[
 [
 [
N Z[_[g6\O[
T himiu+jU[
Z ghlht*i[[
` lmqmy)na[
f himiu%jg[
l deieq!fm[
r himiu%js[
x jkokw'ly[
~ noso{1p[
D mnrnz0oE[
J noso{1pK[
P jkokw-lQ[
V ijnjv,kW[
\ jkokw-l][
b lmqmy'nc[
h deieq0fi[
n cdhdp/eo[
 [
t jniu)j fjeq%f bfam!b fjeq%f hlgs'h hlgs2h gkfr1g hlgs2h Y]Xd0Y X\Wc/X Y]Xd0Yq[
 [
 [
	x ,I666r   c                    g d}g d}g d}g d}g d}g d}|d}|$|g d|z   |z   v rd	}n|||z   |z   |z   |z   v rd
}ndS |d	k    r?d\  }	}
|dv rd}
n(||v rd}	n!||v rd}	n|dk    rd}	n|dk    rd}	n|dk    rd}	|	|	 d}
d|
fS |dk    r|dk    rdS |dk    rdS dS d }	||v rd}	n||v rd}	n||v rd}	n||v rd}	n||v r|}	d }
|	dk    rd}
n|	|	 d}
d|
fS )N)*afazbscscydadeesetfrgahrhuidisitkulaltlvmimsmtnlnoocpiplptrors_latinskslsqsvswtltruzvifrenchgerman)arfaugur)rubeuk)r   rs_cyrillicr   bgr   mnabqadykbdavadarinhchelbeleztab)himrnebhmaiangbhomahscknewgomsabgc)chenkoreanjapanchinese_chttekatar   )r   r   r   r   r   thelr   r   )NN)r   r   r   r   zPP-OCRv5_server_reclatineslavr   r   r   z_PP-OCRv5_mobile_reczPP-OCRv5_server_detr   )PP-OCRv4_mobile_detzPP-OCRv4_mobile_recr   )r   zen_PP-OCRv4_mobile_recarabiccyrillic
devanagarizPP-OCRv3_mobile_recz_PP-OCRv3_mobile_reczPP-OCRv3_mobile_detr   )r   rm   ppocr_versionLATIN_LANGSARABIC_LANGSESLAV_LANGSCYRILLIC_LANGSDEVANAGARI_LANGSSPECIFIC_LANGSrec_langrp   s              r   r$   z"PPStructureV3._get_ocr_model_names  sD   +
 +
 +
X 0//(((
 
 
$
 
 
	
 	
 	
 <D MMM 
 !+ ! ## !	!  !+ "zJ&&'1$Hn;;;!6$$"$$"!!##$,!B!B!B(.88j((t||CCFF!z H{"""%%#''%)))'>))#H!N4!6%$,!B!B!B(.88r   )CNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN)__name__
__module____qualname__r-   propertyru   r   r   r   classmethodr   r   r$   __classcell__)rr   s   @r   r   r      s        %)#' !%%)$(%)$(#',0+/!% $"&!% $  "(,'+(,$(#'$("(,'+59488<7;/3.22615.2-1'+&* $  ")-(,)-"'+&*'+%)!%!" $"!!#In# n# n# n# n# n#`     X  &*!%!" $"!! !% $  "" $  "",1/4'+)-&+)-#GI
 I
 I
 I
 I
^ &*!%!" $"!! !% $  "" $  "",1/4'+)-&+)-#GK
 K
 K
 K
 K
ZO O O 4 4 [4]7 ]7 ]7~`9 `9 `9 `9 `9 `9 `9r   r   c                   0    e Zd Zed             Zd Zd ZdS )r   c                     dS )Npp_structurev3r   rt   s    r   subparser_namez1PPStructureV3CLISubcommandExecutor.subparser_name  rv   r   c                 l   t          |           |                    dt          d           |                    dt          d           |                    dt          d           |                    dt          d	           |                    d
t          d           |                    dt          d           |                    dt          d           |                    dt          d           |                    dt
          d           |                    dt          d           |                    dt          d           |                    dt          d           |                    dt          d           |                    dt          d           |                    dt          d           |                    d t          d!           |                    d"t          d#           |                    d$t
          d%           |                    d&t          d'           |                    d(t          d)           |                    d*t          d+           |                    d,t          d-           |                    d.t          d/           |                    d0t          d1           |                    d2t
          d3           |                    d4t          d5           |                    d6t          d7           |                    d8t
          d9           |                    d:t          d;           |                    d<t          d=           |                    d>t          d?           |                    d@t          dA           |                    dBt          dC           |                    dDt          dE           |                    dFt          dC           |                    dGt          dH           |                    dIt          dJ           |                    dKt          dL           |                    dMt          dN           |                    dOt          dP           |                    dQt          dR           |                    dSt
          dT           |                    dUt          dV           |                    dWt          dX           |                    dYt          dZ           |                    d[t          d\           |                    d]t          d^           |                    d_t          d`           |                    dat
          db           |                    dct          dd           |                    det          df           |                    dgt          dh           |                    dit
          dj           |                    dkt          dl           |                    dmt          dn           |                    dot          dp           |                    dqt          dr           |                    dst          dt           |                    dut          dv           |                    dwt          dx           |                    dyt          dz           |                    d{t          d|           |                    d}t          d~d           d S )Nz--layout_detection_model_namez#Name of the layout detection model.)typehelpz--layout_detection_model_dirz-Path to the layout detection model directory.z--layout_thresholdz/Score threshold for the layout detection model.z--layout_nmsz'Whether to use NMS in layout detection.z--layout_unclip_ratioz+Expansion coefficient for layout detection.z--layout_merge_bboxes_modez!Overlapping box filtering method.z--chart_recognition_model_namez$Name of the chart recognition model.z--chart_recognition_model_dirz.Path to the chart recognition model directory.z--chart_recognition_batch_sizez+Batch size for the chart recognition model.z--region_detection_model_namez#Name of the region detection model.z--region_detection_model_dirz-Path to the region detection model directory.z%--doc_orientation_classify_model_namez<Name of the document image orientation classification model.z$--doc_orientation_classify_model_dirzFPath to the document image orientation classification model directory.z--doc_unwarping_model_namez'Name of the text image unwarping model.z--doc_unwarping_model_dirz,Path to the image unwarping model directory.z--text_detection_model_namez!Name of the text detection model.z--text_detection_model_dirz+Path to the text detection model directory.z--text_det_limit_side_lenzUThis sets a limit on the side length of the input image for the text detection model.z--text_det_limit_typezxThis determines how the side length limit is applied to the input image before feeding it into the text deteciton model.z--text_det_threshzDetection pixel threshold for the text detection model. Pixels with scores greater than this threshold in the output probability map are considered text pixels.z--text_det_box_threshzDetection box threshold for the text detection model. A detection result is considered a text region if the average score of all pixels within the border of the result is greater than this threshold.z--text_det_unclip_ratiozText detection expansion coefficient, which expands the text region using this method. The larger the value, the larger the expansion area.z!--textline_orientation_model_namez7Name of the text line orientation classification model.z --textline_orientation_model_dirz;Path to the text line orientation classification directory.z!--textline_orientation_batch_sizez>Batch size for the text line orientation classification model.z--text_recognition_model_namez#Name of the text recognition model.z--text_recognition_model_dirz-Path to the text recognition model directory.z--text_recognition_batch_sizez*Batch size for the text recognition model.z--text_rec_score_threshzrText recognition threshold used in general OCR. Text results with scores greater than this threshold are retained.z!--table_classification_model_namez'Name of the table classification model.z --table_classification_model_dirz1Path to the table classification model directory.z.--wired_table_structure_recognition_model_namez4Name of the wired table structure recognition model.z---wired_table_structure_recognition_model_dirz>Path to the wired table structure recognition model directory.z1--wireless_table_structure_recognition_model_namez7Name of the wireless table structure recognition model.z0--wireless_table_structure_recognition_model_dirz(--wired_table_cells_detection_model_namez.Name of the wired table cells detection model.z'--wired_table_cells_detection_model_dirz8Path to the wired table cells detection model directory.z+--wireless_table_cells_detection_model_namez1Name of the wireless table cells detection model.z*--wireless_table_cells_detection_model_dirz;Path to the wireless table cells detection model directory.z --seal_text_detection_model_namez&Name of the seal text detection model.z--seal_text_detection_model_dirz0Path to the seal text detection model directory.z--seal_det_limit_side_lenzZThis sets a limit on the side length of the input image for the seal text detection model.z--seal_det_limit_typez}This determines how the side length limit is applied to the input image before feeding it into the seal text deteciton model.z--seal_det_threshzDetection pixel threshold for the seal text detection model. Pixels with scores greater than this threshold in the output probability map are considered text pixels.z--seal_det_box_threshzDetection box threshold for the seal text detection model. A detection result is considered a text region if the average score of all pixels within the border of the result is greater than this threshold.z--seal_det_unclip_ratiozSeal text detection expansion coefficient, which expands the text region using this method. The larger the value, the larger the expansion area.z"--seal_text_recognition_model_namez(Name of the seal text recognition model.z!--seal_text_recognition_model_dirz2Path to the seal text recognition model directory.z"--seal_text_recognition_batch_sizez/Batch size for the seal text recognition model.z--seal_rec_score_threshzcSeal text recognition threshold. Text results with scores greater than this threshold are retained.z --formula_recognition_model_namez&Name of the formula recognition model.z--formula_recognition_model_dirz0Path to the formula recognition model directory.z --formula_recognition_batch_sizez-Batch size for the formula recognition model.z--use_doc_orientation_classifyz9Whether to use document image orientation classification.z--use_doc_unwarpingz$Whether to use text image unwarping.z--use_textline_orientationz4Whether to use text line orientation classification.z--use_seal_recognitionz Whether to use seal recognition.z--use_table_recognitionz!Whether to use table recognition.z--use_formula_recognitionz#Whether to use formula recognition.z--use_chart_recognitionz!Whether to use chart recognition.z--use_region_detectionz Whether to use region detection.z--format_block_contentz,Whether to format block content to Markdown.z--markdown_ignore_labels+z3List of layout labels to ignore in Markdown output.)r   nargsr  )r   add_argumentstrfloatr   int)r   	subparsers     r   _update_subparserz4PPStructureV3CLISubcommandExecutor._update_subparser  s
   !),,,+6 	 	
 	
 	

 	*@ 	 	
 	
 	

 	 B 	 	
 	
 	

 	: 	 	
 	
 	

 	#> 	 	
 	
 	

 	(4 	 	
 	
 	
 	,7 	 	
 	
 	

 	+A 	 	
 	
 	

 	,> 	 	
 	
 	
 	+6 	 	
 	
 	

 	*@ 	 	
 	
 	
 	3O 	 	
 	
 	

 	2Y 	 	
 	
 	

 	(: 	 	
 	
 	

 	'? 	 	
 	
 	
 	)4 	 	
 	
 	

 	(> 	 	
 	
 	

 	'h 	 	
 	
 	

 	# L 	 	
 	
 	

 	 t 	 	
 	
 	

 	# [ 	 	
 	
 	

 	% _ 	 	
 	
 	

 	/J 	 	
 	
 	

 	.N 	 	
 	
 	

 	/Q 	 	
 	
 	

 	+6 	 	
 	
 	

 	*@ 	 	
 	
 	

 	+= 	 	
 	
 	

 	% F 	 	
 	
 	
 	/: 	 	
 	
 	

 	.D 	 	
 	
 	

 	<G 	 	
 	
 	

 	;Q 	 	
 	
 	

 	?J 	 	
 	
 	

 	>Q 	 	
 	
 	

 	6A 	 	
 	
 	

 	5K 	 	
 	
 	

 	9D 	 	
 	
 	

 	8N 	 	
 	
 	
 	.9 	 	
 	
 	

 	-C 	 	
 	
 	

 	'm 	 	
 	
 	

 	# Q 	 	
 	
 	

 	 y 	 	
 	
 	

 	# ` 	 	
 	
 	

 	% d 	 	
 	
 	

 	0; 	 	
 	
 	

 	/E 	 	
 	
 	

 	0B 	 	
 	
 	

 	%v 	 	
 	
 	
 	.9 	 	
 	
 	

 	-C 	 	
 	
 	

 	.@ 	 	
 	
 	
 	,L 	 	
 	
 	

 	!7 	 	
 	
 	

 	(G 	 	
 	
 	

 	$3 	 	
 	
 	

 	%4 	 	
 	
 	

 	'6 	 	
 	
 	

 	%4 	 	
 	
 	

 	$3 	 	
 	
 	
 	$? 	 	
 	
 	

 	&F	 	 	
 	
 	
 	
 	
r   c                 N    t          |          }t          t          |           d S r   )r   r   r   )r   argsrq   s      r   execute_with_argsz4PPStructureV3CLISubcommandExecutor.execute_with_args  s1    $T** 	
 	
 	
 	
 	
r   N)r   r   r   r   r   r	  r  r   r   r   r   r     sO            X G
 G
 G
R

 
 
 
 
r   r   )r&   
_utils.clir   r   r   r   baser	   r
   utilsr   _patch_layout_parsingr   _apply_layout_parsing_patchesr    r   r   r   r   r   <module>r     s               H G G G G G G G / / / / / / Q Q Q Q Q Q     >>> S
9 S
9 S
9 S
9 S
9* S
9 S
9 S
9lS
 S
 S
 S
 S
)F S
 S
 S
 S
 S
r   