o
    ªZhi  ã                   @   s4   d dl Z d dlmZ d dlmZ G dd„ deƒZdS )é    N)Úpartial)Úreplace_punctuationc                   @   s    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&S )'ÚBetweenPunctuationz(?<=\s)'(?:[^']|'[a-zA-Z])*'u$   (?<=\s)â€˜(?:[^â€™]|â€™[a-zA-Z])*â€™z"(?>[^"\\]+|\\{2}|\\.)*"z*"(?=(?P<tmp>[^\"\\]+|\\{2}|\\.)*)(?P=tmp)"u   Â«(?>[^Â»\\]+|\\{2}|\\.)*Â»u.   \Â«(?=(?P<tmp>[^Â»\\]+|\\{2}|\\.)*)(?P=tmp)\Â»u   â€œ(?>[^â€\\]+|\\{2}|\\.)*â€u1   \â€œ(?=(?P<tmp>[^â€\\]+|\\{2}|\\.)*)(?P=tmp)\â€z\[(?>[^\]\\]+|\\{2}|\\.)*\]z,\[(?=(?P<tmp>[^\]\\]+|\\{2}|\\.)*)(?P=tmp)\]z\((?>[^\(\)\\]+|\\{2}|\\.)*\)z.\((?=(?P<tmp>[^\(\)\\]+|\\{2}|\\.)*)(?P=tmp)\)z(?<=\s)'(?:[^']|'[a-zA-Z])*'\Sz\-\-(?>[^\-\-])*\-\-z--(?=(?P<tmp>[^--]*))(?P=tmp)--c                 C   s
   || _ d S ©N)Útext)Úselfr   © r   úP/var/www/html/lang_env/lib/python3.10/site-packages/pysbd/between_punctuation.pyÚ__init__/   s   
zBetweenPunctuation.__init__c                 C   s   |   | j¡S r   )Ú)sub_punctuation_between_quotes_and_parensr   )r   r   r   r	   Úreplace2   s   zBetweenPunctuation.replacec                 C   sT   |   |¡}|  |¡}|  |¡}|  |¡}|  |¡}|  |¡}|  |¡}|  |¡}|S r   )Ú%sub_punctuation_between_single_quotesÚ,sub_punctuation_between_single_quote_slantedÚ%sub_punctuation_between_double_quotesÚ'sub_punctuation_between_square_bracketsÚsub_punctuation_between_parensÚ$sub_punctuation_between_quotes_arrowÚ!sub_punctuation_between_em_dashesÚ&sub_punctuation_between_quotes_slanted©r   Útxtr   r   r	   r   5   s   







z<BetweenPunctuation.sub_punctuation_between_quotes_and_parensc                 C   ó   t  | jt|¡S r   )ÚreÚsubÚBETWEEN_PARENS_REGEX_2r   r   r   r   r	   r   @   ó   z1BetweenPunctuation.sub_punctuation_between_parensc                 C   r   r   )r   r   ÚBETWEEN_SQUARE_BRACKETS_REGEX_2r   r   r   r   r	   r   C   ó   
ÿz:BetweenPunctuation.sub_punctuation_between_square_bracketsc                 C   s6   t  | j|¡rt  d|¡s|S t  | jttdd|¡S )Nz'\sÚsingle)Z
match_type)r   ÚsearchÚWORD_WITH_LEADING_APOSTROPHEr   ÚBETWEEN_SINGLE_QUOTES_REGEXr   r   r   r   r   r	   r   G   s   
ÿÿz8BetweenPunctuation.sub_punctuation_between_single_quotesc                 C   r   r   )r   r   Ú"BETWEEN_SINGLE_QUOTE_SLANTED_REGEXr   r   r   r   r	   r   N   s   ÿz?BetweenPunctuation.sub_punctuation_between_single_quote_slantedc                 C   r   r   )r   r   ÚBETWEEN_DOUBLE_QUOTES_REGEX_2r   r   r   r   r	   r   R   r   z8BetweenPunctuation.sub_punctuation_between_double_quotesc                 C   r   r   )r   r   ÚBETWEEN_QUOTE_ARROW_REGEX_2r   r   r   r   r	   r   V   r   z7BetweenPunctuation.sub_punctuation_between_quotes_arrowc                 C   r   r   )r   r   ÚBETWEEN_EM_DASHES_REGEX_2r   r   r   r   r	   r   Y   r   z4BetweenPunctuation.sub_punctuation_between_em_dashesc                 C   r   r   )r   r   ÚBETWEEN_QUOTE_SLANTED_REGEX_2r   r   r   r   r	   r   \   r   z9BetweenPunctuation.sub_punctuation_between_quotes_slantedN)Ú__name__Ú
__module__Ú__qualname__r!   r"   ZBETWEEN_DOUBLE_QUOTES_REGEXr#   ZBETWEEN_QUOTE_ARROW_REGEXr$   ZBETWEEN_QUOTE_SLANTED_REGEXr&   ZBETWEEN_SQUARE_BRACKETS_REGEXr   ZBETWEEN_PARENS_REGEXr   r    ZBETWEEN_EM_DASHES_REGEXr%   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r	   r      s6    r   )r   Ú	functoolsr   Zpysbd.punctuation_replacerr   Úobjectr   r   r   r   r	   Ú<module>   s   