
    kh                         d dl Z d dlZ e j                  d e j                  ej                         d      Zd	dZd	dZd
dZddZ	d Z
y)    N[]c                     |r$t         j                  d| j                               S | j                         j                  t        j                        S )zRemoves punctuation from a string.

    :param s: The string.
    :param all: Remove all punctuation. If False, only removes punctuation from
        the ends of the string.
     )PUNCTUATION_REGEXsubstripstringpunctuationsalls     J/opt/mcp/mcp-sentiment/venv/lib/python3.12/site-packages/textblob/utils.py
strip_puncr      s;      $$R33wwyv1122    c                 T    t        | j                         j                         |      S )zMakes text all lowercase and strips punctuation and whitespace.

    :param s: The string.
    :param all: Remove all punctuation. If False, only removes punctuation from
        the ends of the string.
    )r   )r   lowerr	   r   s     r   
lowerstripr      s     aggioo'S11r   c                 V    |j                  | D cg c]  \  }}|	 c}}      S c c}}w )zConvert a nltk.tree.Tree to a string.

    For example:
        (NP a/DT beautiful/JJ new/JJ dashboard/NN) -> "a beautiful dashboard"
    )join)treeconcatwordtags       r   tree2strr      s%     ;;5$5665s   %
c                     g }| D ]9  \  }}d}|D ]  }|j                  |      sd} n |s'|j                  ||f       ; |S )zAFilter out insignificant (word, tag) tuples from a chunk of text.TF)endswithappend)chunktag_suffixesgoodr   r   oksuffixs          r   filter_insignificantr$   '   s^    D %	c" 	F||F#	 KKs$% Kr   c                     t        | d      S )z-Return whether ``obj`` is a file-like object.read)hasattr)objs    r   is_fileliker)   5   s    3r   )F) ))DTCCzPRP$PRP)rer
   compileescaper   r   r   r   r   r$   r)    r   r   <module>r2      sP    	 BJJ9299V-?-?#@"ACD 
327 r   