
    j=                     h    d Z ddlZddlmZ ddlmZ e G d d                      Z e            ZdS )a  
This module contains variables that can permitted to be tweaked by the system environment. For
example, model parameters that changes the output of an inference call. Constants do NOT belong in
this module. Constants are values that are usually names for common options (e.g., color names) or
settings that should not be altered without making a code change (e.g., definition of 1Gb of memory
in bytes). Constants should go into `./constants.py`
    N)	dataclass)OCR_AGENT_TESSERACTc                      e Zd ZdZddededefdZdededefdZdededefdZ	e
defd	            Ze
defd
            Ze
defd            Ze
defd            Ze
defd            Ze
defd            Ze
defd            ZdS )	ENVConfigz+class for configuring enviorment parameters vardefault_valuereturnc                 B    t           j                            ||          S )zhattempt to get the value of var from the os environment; if not present return the
        default_value)osenvironget)selfr   r	   s      m/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/unstructured/partition/utils/config.py_get_stringzENVConfig._get_string   s     z~~c=111    c                 R    |                      |          x}rt          |          S |S N)r   intr   r   r	   values       r   _get_intzENVConfig._get_int   s/    $$S)))5 	u::r   c                 R    |                      |          x}rt          |          S |S r   )r   floatr   s       r   
_get_floatzENVConfig._get_float   s/    $$S)))5 	 <<r   c                 .    |                      dd          S )zRextra image content to add around an identified element region; measured in pixelsIMAGE_CROP_PADr   r   r   s    r   r   zENVConfig.IMAGE_CROP_PAD!   s     }}-q111r   c                 .    |                      dd          S )zextra image content to add around an identified table region; measured in pixels

        The padding adds image data around an identified table bounding box for downstream table
        structure detection model use as input
        TABLE_IMAGE_CROP_PADr   r   r   s    r   r!   zENVConfig.TABLE_IMAGE_CROP_PAD&   s     }}3Q777r   c                 .    |                      dd          S )z%the quantile to check for text heightTESSERACT_TEXT_HEIGHT_QUANTILEg      ?)r   r   s    r   r#   z(ENVConfig.TESSERACT_TEXT_HEIGHT_QUANTILE/   s     ?EEEr   c                 .    |                      dd          S )zminimum text height acceptable from tesseract OCR results

        if estimated text height from tesseract OCR results is lower than this value the image is
        scaled up to be processed again
        TESSERACT_MIN_TEXT_HEIGHT   r   r   s    r   r%   z#ENVConfig.TESSERACT_MIN_TEXT_HEIGHT4   s     }}8"===r   c                 .    |                      dd          S )zmaximum text height acceptable from tesseract OCR results

        if estimated text height from tesseract OCR results is higher than this value the image is
        scaled down to be processed again
        TESSERACT_MAX_TEXT_HEIGHTd   r   r   s    r   r(   z#ENVConfig.TESSERACT_MAX_TEXT_HEIGHT=   s     }}8#>>>r   c                 .    |                      dd          S )z%optimum text height for tesseract OCRTESSERACT_OPTIMUM_TEXT_HEIGHT   r   r   s    r   r+   z'ENVConfig.TESSERACT_OPTIMUM_TEXT_HEIGHTF   s     }}<bAAAr   c                 8    |                      dt                    S )zterror margin when comparing if a ocr region is within the table element when preparing
        table tokens
        	OCR_AGENT)r   r   r   s    r   r.   zENVConfig.OCR_AGENTK   s    
 -@AAAr   N)r   )__name__
__module____qualname____doc__strr   r   r   r   r   propertyr   r!   r#   r%   r(   r+   r.    r   r   r   r      s       552 2s 23 2 2 2 2 2
C      
c % E    
 2 2 2 2 X2 8c 8 8 8 X8 F F F F XF >3 > > > X> ?3 ? ? ? X? Bs B B B XB B3 B B B XB B Br   r   )r2   r   dataclassesr   &unstructured.partition.utils.constantsr   r   
env_configr5   r   r   <module>r9      s     
			 ! ! ! ! ! ! F F F F F F AB AB AB AB AB AB AB ABH Y[[


r   