
    :Qg                        U d Z ddlmZmZmZ ddlmZmZ ddlm	Z	 de
e   fdZdeee	f   fdZ eej                        ZeD  ci c],  }  |        j"                  D ]  }| |        j$                  f|  . c}} Zeeeef   eej                     f   ed<   eD  ci c]*  }  |        j"                  D ]  } |        j$                  |  , c}} Zeeeej                     f   ed	<   i d
ej.                  dej0                  dej2                  dej4                  dej6                  dej8                  dej:                  dej<                  dej>                  dej@                  dejB                  dejD                  dejF                  dejH                  dejJ                  dejL                  dejN                  i dejP                  dejR                  dejR                  dejR                  dejR                  d ejT                  d!ejV                  d"ejX                  d#ejZ                  d$ej\                  d%ej^                  d&ej`                  d'ejb                  d(ejd                  d)ejf                  d*ejh                  d+ejj                  ejl                  ej>                  ejn                  ejB                  ejp                  ejr                  ejt                  ejv                  ejx                  ejz                  ej|                  ej~                  ej                  ej                  ej                  d,ZCeeeej                     f   ed-<    e       ZDy.c c}} w c c}} w )/z
This module contains mapping between:
HTML Tags <-> Elements Ontology <-> Unstructured Element classes
They are used to simplify transformations between different representations
of parsed documents
    )AnyDictType)elementsontology)Elementreturnc                     | j                         }|j                         }|D ]  }|j                  t        |              |S )z
    Recursively find all subclasses of a given class.

    Parameters:
    cls (type): The class for which to find all subclasses.

    Returns:
    list: A list of all subclasses of the given class.
    )__subclasses__copyextendget_all_subclasses)cls
subclassesall_subclassessubclasss       \/var/www/html/answerous/venv/lib/python3.12/site-packages/unstructured/documents/mappings.pyr   r      sI     ##%J__&N <0:;<     c                  F   i t         j                  t        j                  t         j                  t        j                  t         j
                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                   t        j                  t         j"                  t        j                  t         j$                  t        j&                  t         j(                  t        j(                  i t         j*                  t        j                  t         j,                  t        j                  t         j.                  t        j                  t         j0                  t        j                  t         j2                  t        j2                  t         j4                  t        j4                  t         j6                  t        j4                  t         j8                  t        j4                  t         j:                  t        j4                  t         j<                  t        j4                  t         j>                  t        j4                  t         j@                  t        j@                  t         jB                  t        j@                  t         jD                  t        j                  t         jF                  t        j                  t         jH                  t        j@                  t         jJ                  t        j@                  i t         jL                  t        j@                  t         jN                  t        jP                  t         jR                  t        jP                  t         jT                  t        jT                  t         jV                  t        jT                  t         jX                  t        j                  t         jZ                  t        j                  t         j\                  t        j                  t         j^                  t        j                  t         j`                  t        j                  t         jb                  t        j                  t         jd                  t        j                  t         jf                  t        j                  t         jh                  t        j                  t         jj                  t        j4                  t         jl                  t        j                  t         jn                  t        j                  i t         jp                  t        j                  t         jr                  t        j                  t         jt                  t        j                  t         jv                  t        j                  t         jx                  t        j                  t         jz                  t        j                  t         j|                  t        j                  t         j~                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  t         j                  t        j                  i} | S )au  
    Get a mapping of ontology element to unstructured type.

    The dictionary here was created base on ontology mapping json
    Can be generated via the following code:
    ```
        ontology_elements_list = json.loads(
            Path("unstructured_element_ontology.json").read_text()
        )
        ontology_to_unstructured_class_mapping = {
            ontology_element["name"]: ontology_element["ontologyV1Mapping"]
            for ontology_element in ontology_elements_list
    }
    ```

    Returns:
    dict: A dictionary where keys are ontology element classes
          and values are unstructured types.
    )Lr   Documentr   TextSectionPageColumn	ParagraphNarrativeTextHeaderFooterSidebar	PageBreakTitleSubtitleHeadingQuoteFootnoteCaptionFigureCaption
PageNumberUncategorizedTextOrderedListUnorderedListDefinitionListListItemTableTableRow	TableCellTableCellHeader	TableBodyTableHeaderImageFigureVideoAudioBarcodeQRCodeLogo	CodeBlockCodeSnippet
InlineCodeFormulaEquationFootnoteReferenceCitationBibliographyGlossaryAuthorMetaDateKeywordsAbstract	HyperlinkTableOfContentsIndexForm	FormFieldFormFieldValueCheckboxRadioButtonButtonComment	HighlightRevisionInsertionRevisionDeletionAddressEmailAddressPhoneNumberCalendarDateTimeCurrencyMeasurement
Letterhead	Signature	WatermarkStamp)&ontology_to_unstructured_class_mappings    r   )get_ontology_to_unstructured_type_mappingra   !   s   (H.8==H.(--H. 	x}}H. 		H.
 	H22H. 	H. 	H. 	(--H. 	H..H. 	H. 	8>>H. 	(..H. 	 6 6H. 	..H. 	8==H.  	(00!H." 	X00#H.$ 	""HMM%H.& 	hmm'H.( 	)H.* 	+H., 	8,,-H.. 	/H.0 	8>>1H.2 	HNN3H.4 	  (..5H.6 	HNN7H.8 	hnn9H.: 	;H.< 	=H.> 	?H.@ 	AH.B 	(..CH.D 	EH.F 	x~~GH.H 	H00IH.J 	X11KH.L 	(**MH.N 	8++OH.P 	""HMMQH.R 	8==SH.T 	x}}UH.V 	8==WH.X 	YH.Z 	8==[H.\ 	8==]H.^ 	811_H.` 	HMMaH.b 	  (..cH.d 	eH.f 	x}}gH.h 	HMMiH.j 	kH.l 	8==mH.n 	hmmoH.p 	qH.r 	(--sH.t 	HMMuH.v 	""HMMwH.x 	!!8==yH.z 	(**{H.| 	x44}H.~ 	hmmH.@ 	x}}AH.B 	x}}CH.D 	8==EH.F 	hmmGH.H 	X__IH.J 	HMMHMMOH.*T 21r   )HTML_TAG_AND_CSS_NAME_TO_ELEMENT_TYPE_MAPCSS_CLASS_TO_ELEMENT_TYPE_MAPaaddressasideaudio
blockquotebodybuttoncitecodedeldivdl
figcaptionfigurefooterformh1h2h3h4h5h6headerhrimginputinslabellimarkmathmetanavol)ppresectionspansubsvgtabletbodytdththeadtimetrulvideo$HTML_TAG_TO_DEFAULT_ELEMENT_TYPE_MAPN)E__doc__typingr   r   r   unstructured.documentsr   r   unstructured.documents.elementsr   listr   dictstrra   OntologyElementALL_ONTOLOGY_ELEMENT_TYPESallowed_tagscss_class_namerb   tuple__annotations__rc   rH   rU   r   r7   r$   r   rP   rA   r;   rT   r)   r,   r&   r5   r   rK   r!   r"   r#   r   r    r4   rN   rS   rL   r-   rR   r?   rF   rJ   r*   r   r   r@   r]   r.   r2   r0   r1   r3   rY   r/   r+   r6   r   +ONTOLOGY_CLASS_TO_UNSTRUCTURED_ELEMENT_TYPE)element_typetags   00r   <module>r      sh   # " 5 3tCy &^24W3E ^2B 00H0HI  3d~**d 	 	,.
'
'(,6d(d )4c3hhF^F^A_0_+`  3L~**L 	 N!!</L!L tCh.F.F)G$GH 2S		2Sx2S X2S X^^	2S
 (..2S H2S hoo2S H2S H2S 
8$$2S 
8%%2S 	(
!
!2S (""2S hoo2S hoo2S  HMM!2S" 	(..#2S$ 	(

%2S& 	(

'2S( 	(

)2S* 	(

+2S, 	(

-2S. hoo/2S0 	(

12S2 
8>>32S4 X52S6 
8%%72S8 X92S: 	(

;2S< H=2S> H?2S@ HA2SB 
8>>C2SD 	(

E2SF 
		&&%%^^




"
"!!MM




 
 ^^c2S $d3X5M5M0N+N&O 2j /X.Y +Ad
Ls   1M,/M2