
    h                     j    S SK r S SKrS SKJr  0 rSSSSSSSSSS	S	S
.rS rS rS rSS\	4S jjr
S rg)    N)data_filenameu   ፣u   ، ,u   、u   ၊ z, u   ，)amarbrxfajamyugunduryuezhc                     U R                  5       n U R                  SS5      n U R                  SS5      n U R                  SS5      n U R                  SS5      n U R                  SS5      n U R                  5       $ )	z
When looking up a language-code component by name, we would rather ignore
distinctions of case and certain punctuation. "Chinese (Traditional)"
should be matched by "Chinese Traditional" and "chinese traditional".
u   ’'- ( )r   )casefoldreplacestrip)names    M/home/james-whalen/.local/lib/python3.13/site-packages/language_data/names.pynormalize_namer      sk     ==?D<<s#D<<S!D<<R D<<R D<<R D::<    c                     [         R                  " 5       n[        R                  " 5          [        R                  " S5        UR                  U 5        SSS5        U$ ! , (       d  f       U$ = f)z7
Load a BytesTrie from the marisa_trie on-disk format.
ignoreN)marisa_trie	BytesTriewarningscatch_warningssimplefilterload)filenametries     r   	load_trier(   *   sT       "D		 	 	"h'		( 
# K 
#	" Ks   (A
A,c                 .    X   S   R                  S5      $ )z
Get the value that a BytesTrie stores for a particular key, decoded
as Unicode. Raises a KeyError if there is no value for that key.
r   zutf-8)decode)r'   keys     r   get_trie_valuer,   6   s    
 9Q<w''r   languagec                 z   SU;  d   S5       eSU;  d   S5       eSR                  X 5      nU[        ;  a*  [        [        SR                  U5      5      5      [        U'   [        U   n[	        U5      nXT;   a  [        XE5      $ UR                  U5      nU(       a   [        US   5      S:  a  [        XFS   5      $ g	)
u  
Get a language, script, or territory by its name in some language.

The language here must be a string representing a language subtag only.
The `Language.find` method can handle other representations of a language
and normalize them to this form.

The default language, "und", will allow matching names in any language,
so you can get the code 'fr' by looking up "French", "Français", or
"francés".

A small amount of fuzzy matching is supported: if the name can be
shortened or lengthened to match a single language name, you get that
language. This allows, for example, "Hakka Chinese" to match "Hakka".

Occasionally, names are ambiguous in a way that can be resolved by
specifying what name the language is supposed to be in. For example,
there is a language named 'Malayo' in English, but it's different from
the language named 'Malayo' in Spanish (which is Malay). Specifying the
language will look up the name in a trie that is only in that language.
/z%Language codes cannot contain slashesr   z5This code should be reduced to a language subtag onlyz{}/name_to_{}ztrie/{}.marisa   N)formatTRIESr(   r   r   r,   prefixeslen)categoryr   r-   	trie_namer'   lookupr4   s          r   name_to_coder9   >   s    , hG GGhW WW&&x:I$]3C3J3J93U%VWiDD!F~d++
 ==(HRL)Q.!$55r   c                 V    SSK nUR                  R                  R                  U 0 5      $ )zj
Given the code for a language, script, or territory, get a dictionary of its
names in various languages.
r   N)language_data.name_data	name_dataCODE_TO_NAMESget)codelanguage_datas     r   code_to_namesrA   i   s&     #""0044T2>>r   )r   )r    r"   language_data.utilr   r3   DISPLAY_SEPARATORSr   r(   r,   strr9   rA    r   r   <module>rF      sa      , 	 






 	((3 (V?r   