
    /hR                     |    S r SSKrSSKrSSKrSSKJr  SSKrSSKJ	r	   " S S5      r
 " S S5      r " S	 S
5      rg)a  
If you use the VADER sentiment analysis tools, please cite:

Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for
Sentiment Analysis of Social Media Text. Eighth International Conference on
Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.
    N)product)pairwisec                   .   \ rS rSrSrSrSrSrSr1 Skr	0 S\_S	\_S
\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_0 S\_S\_S\_S\_S\_S\_S\_S \_S!\_S"\_S#\_S$\_S%\_S&\_S'\_S(\_S)\_E0 S*\_S+\_S,\_S-\_S.\_S/\_S0\_S1\_S2\_S3\_S4\_S5\_S6\_S7\_S8\_S9\_S:\_E\\\\\\\\\\\\\\\S;.Er
S<S<S=S>S?S@S>SA.r\R                  " SB\R                  " \R                   5       SC35      r/ SDQrSE rSKSF jrSLSG jrSH rSIrgJ)MVaderConstants!   z0
A class to keep the Vader lists and constants.
gn?gnҿg~jt?gGz>;   nornotaintcantdontisntnonenopeuhuhwontarentdidnthadnthasntnevershantwasntcannotdarentdoesnthaventmustntneedntrarelyseldomwerentcouldntdespitemightntneithernothingnowhereoughtntwithoutwouldntshouldntain'tcan'tdon'tisn'tuh-uhwon'taren'tdidn'thadn'thasn'tshan'twasn'tdaren'tdoesn'thaven'tmustn'tneedn'tweren'tcouldn'tmightn'toughtn'twouldn't	shouldn't
absolutely	amazinglyawfully
completelyconsiderably	decidedlydeeplyeffing
enormouslyentirely
especiallyexceptionally	extremely
fabulouslyflippingflippinfrickingfrickinfriggingfrigginfullyfuckinggreatlyhellahighlyhugely
incredibly	intenselymajorlymoremostparticularlypurelyquitereally
remarkablysosubstantially
thoroughlytotallytremendouslyuberunbelievably	unusuallyutterlyveryalmostbarelyhardlyzjust enoughzkind of)kindakindofzkind-oflesslittle
marginallyoccasionallypartlyscarcelyslightlysomewhatzsort ofsortasortofzsort-of         ?   g      )zthe shitzthe bombzbad assz
yeah rightzcut the mustardzkiss of deathzhand to mouth[]).!?,;:-'"z!!z!!!z??z???z?!?z!?!z?!?!z!?!?c                     g N )selfs    L/var/www/auris/envauris/lib/python3.13/site-packages/nltk/sentiment/vader.py__init__VaderConstants.__init__   s        c                   ^ U R                   m[        U4S jU 5       5      (       a  gU(       a  [        S U 5       5      (       a  g[        U5       H1  u  p4UR                  5       S:X  d  M  UR                  5       S:w  d  M1    g   g)z,
Determine if input contains negation words
c              3   H   >#    U  H  oR                  5       T;   v   M     g 7fr   lower).0word	neg_wordss     r   	<genexpr>)VaderConstants.negated.<locals>.<genexpr>   s     A[Tzz|y([s   "Tc              3   H   #    U  H  nS UR                  5       ;   v   M     g7f)zn'tNr   )r   r   s     r   r   r      s     A[T5DJJL([s    "leastatF)NEGATEanyr   r   )r   input_words
include_ntfirstsecondr   s        @r   negatedVaderConstants.negated   sm     KK	A[AAAA[AAA%k2ME||~(U[[]d-B 3 r   c                 B    U[         R                  " X-  U-   5      -  nU$ )zd
Normalize the score to be between -1 and 1 using an alpha that
approximates the max expected value
)mathsqrt)r   scorealpha
norm_scores       r   	normalizeVaderConstants.normalize   s$    
 TYY'>??
r   c                     SnUR                  5       nXPR                  ;   aZ  U R                  U   nUS:  a  US-  nUR                  5       (       a+  U(       a$  US:  a  X@R                  -  nU$ X@R                  -  nU$ )zP
Check if the preceding words increase, decrease, or negate/nullify the
valence
        r   )r   BOOSTER_DICTisupperC_INCR)r   r   valenceis_cap_diffscalar
word_lowers         r   scalar_inc_decVaderConstants.scalar_inc_dec   sz    
 ZZ\
***&&z2F{"||~~+Q;kk)F  kk)Fr   r   N)T)   )__name__
__module____qualname____firstlineno____doc__B_INCRB_DECRr   N_SCALARr   r   SPECIAL_CASE_IDIOMSrecompileescapestringpunctuationREGEX_REMOVE_PUNCTUATION	PUNC_LISTr   r   r   r   __static_attributes__r   r   r   r   r   !   s    FF FH<FBCfCVC 	6C 	f	C
 	C 	VC 	&C 	&C 	fC 	FC 	fC 	C 	VC 	fC 	FC  	6!C" 	F#C$ 	6%C& 	F'C( 	6)C* 	+C, 	6-C. 	6/C0 	1C2 	&3C4 	&5C6 	f7C8 	V9C: 	6;C< 	=C> 	?C@ 	ACB 	&CCD 	ECF 	&GCH 	fICJ 	fKCL 	MCN 	fOCP 	6QCR 	SCT 	UCV 	WCX 	VYCZ 	6[C\ 	]C^ 	&_C` 	&aCb 	&cCd 	veCf 	6gCh ECLN   "zzAbii8J8J.K-LA*NOI(r   r   c                   0    \ rS rSrSrS rS rS rS rSr	g)		SentiTexti  zD
Identify sentiment-relevant string-level properties of input text.
c                     [        U[        5      (       d  [        UR                  S5      5      nXl        X l        X0l        U R                  5       U l        U R                  U R                  5      U l	        g )Nzutf-8)

isinstancestrencodetextr   r   _words_and_emoticonswords_and_emoticonsallcap_differentialr   )r   r   	punc_listregex_remove_punctuations       r   r   SentiText.__init__  s^    $$$t{{7+,D	"(@%#'#<#<#>   33D4L4LMr   c                    U R                   R                  SU R                  5      nUR                  5       nU Vs1 s H  n[	        U5      S:  d  M  UiM     nn[        U R                  U5       Vs0 s H  nSR                  U5      US   _M     nn[        X R                  5       Vs0 s H  nSR                  U5      US   _M     nnUnUR                  U5        U$ s  snf s  snf s  snf )zD
Returns mapping of form:
{
    'cat,': 'cat',
    ',cat': 'cat',
}
    r   )	r   subr   splitlenr   r   joinupdate)r   no_punc_text
words_onlywppunc_before
punc_afterwords_punc_dicts           r   _words_plus_puncSentiText._words_plus_punc  s     4488TYYG!'')
!+:As1vza
:181TU1TArwwqz1Q4'1TU07
NN0ST0S1bggaj!A$&0S
T%z* ;UTs   C C 2C%*C*c                     U R                   R                  5       nU R                  5       nU Vs/ s H  n[        U5      S:  d  M  UPM     nn[	        U5       H  u  pCX2;   d  M  X#   X'   M     U$ s  snf )z
Removes leading and trailing puncutation
Leaves contractions and most emoticons
    Does not preserve punc-plus-letter emoticons (e.g. :D)
r   )r   r   r   r   	enumerate)r   wesr   weis        r   r   SentiText._words_and_emoticons+  sl     iioo//1/Cb3r7Q;rC/s^EA$(, $ 
	 0s   A1A1c                     SnSnU H  nUR                  5       (       d  M  US-  nM!     [        U5      U-
  nSUs=:  a  [        U5      :  a  O  U$ SnU$ )z
Check whether just some words in the input are ALL CAPS

:param list words: The words to inspect
:returns: `True` if some but not all items in `words` are ALL CAPS
Fr   r   T)r   r   )r   wordsis_differentallcap_wordsr   cap_differentials         r   r   SentiText.allcap_differential9  sc     D||~~!  u:4,#e*,  Lr   )r   r   r   r   r   N)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s    	N(r   r   c                   l    \ rS rSrSr SS jrS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rSrg)SentimentIntensityAnalyzeriK  z0
Give a sentiment intensity score to sentences.
c                     [         R                  R                  U5      U l        U R	                  5       U l        [        5       U l        g r   )nltkdataloadlexicon_filemake_lex_dictlexiconr   	constants)r   r  s     r   r   #SentimentIntensityAnalyzer.__init__P  s3     !IINN<8))+')r   c                     0 nU R                   R                  S5       H4  nUR                  5       R                  S5      SS u  p4[        U5      X'   M6     U$ )z&
Convert lexicon file to a dictionary

	r   r   )r  r   stripfloat)r   lex_dictliner   measures        r   r  (SentimentIntensityAnalyzer.make_lex_dictX  sU     %%++D1D"jjl006q;OT"7^HN 2 r   c                    [        XR                  R                  U R                  R                  5      n/ nUR                  nU H  nSnUR                  U5      nU[        U5      S-
  :  a-  UR                  5       S:X  a  XGS-      R                  5       S:X  d(  UR                  5       U R                  R                  ;   a  UR                  U5        M  U R                  XbXWU5      nM     U R                  XC5      nU R                  X15      $ )a  
Return a float for sentiment strength based on the input text.
Positive values are positive valence, negative value are negative
valence.

:note: Hashtags are not taken into consideration (e.g. #BAD is neutral). If you
    are interested in processing the text in the hashtags too, then we recommend
    preprocessing your data to remove the #, after which the hashtag text may be
    matched as if it was a normal word in the sentence.
r   r   kindof)r   r  r   r   r   indexr   r   r   appendsentiment_valence
_but_checkscore_valence)r   r   	sentitext
sentimentsr   itemr   r   s           r   polarity_scores*SentimentIntensityAnalyzer.polarity_scoresb  s     ..**DNN,S,S
	 
';;'DG#))$/AC+,q00JJLF*'A.446$>!<!<<!!'*//DZXJ ( __%8E
!!*33r   c                    UR                   nUR                  nUR                  5       nXR                  ;   Ga,  U R                  U   nUR	                  5       (       a>  U(       a7  US:  a  XR
                  R                  -  nOXR
                  R                  -  n[        SS5       H  n	XI:  d  M
  XtU	S-   -
     R                  5       U R                  ;  d  M2  U R
                  R                  XtU	S-   -
     X5      n
U	S:X  a  U
S:w  a  U
S-  n
U	S:X  a  U
S:w  a  U
S-  n
X-   nU R                  XX5      nU	S:X  d  M  U R                  XU5      nM     U R                  XU5      nUR                  U5        U$ )Nr   r   r   gffffff?r   g?)r   r   r   r  r   r  r   ranger   _never_check_idioms_check_least_checkr  )r   r   r  r  r   r  r   r   item_lowercasestart_iss              r   r  ,SentimentIntensityAnalyzer.sentiment_valence  sd   ++';;\\)ll>2G ||~~+Q;~~444G~~444G A;K+1,=>DDF<<( 55+1,=>A !|QH!|QG%kG"//gG !|"&"4"4WST"U+ '< ''aHG'"r   c                    US:  a  X#S-
     R                  5       U R                  ;  ae  X#S-
     R                  5       S:X  aL  X#S-
     R                  5       S:w  a1  X#S-
     R                  5       S:w  a  XR                  R                  -  nU$ US:  aT  X#S-
     R                  5       U R                  ;  a1  X#S-
     R                  5       S:X  a  XR                  R                  -  nU$ )Nr   r   r   r   rp   r   )r   r  r  r   )r   r   r   r   s       r   r   'SentimentIntensityAnalyzer._least_check  s     E#E*002$,,F#E*002g= $E*002d:'A.446&@!NN$;$;;  E#E*002$,,F#E*002g= 7 77Gr   c                     U Vs/ s H  o3R                  5       PM     nnS1[        U5      -  nU(       aS  UR                  [        [	        U5      5      5      n[        U5       H!  u  pgXe:  a	  US-  X&'   M  Xe:  d  M  US-  X&'   M#     U$ s  snf )Nbutg      ?r   )r   setr  nextiterr   )r   r   r  w_er(  bisidx	sentiments           r   r  %SentimentIntensityAnalyzer._but_check  s    6IJ6Isyy{6IJg/00$**4S	?;B#,Z#89'03J$Y'03J$	 $9
  Ks   Bc                    X#S-
      SX#    3nSR                  X#S-
     X#S-
     X#   5      nX#S-
      SX#S-
      3nSR                  X#S-
     X#S-
     X#S-
     5      nSR                  X#S-
     X#S-
     5      nXEXgU/n	U	 H7  n
XR                  R                  ;   d  M  U R                  R                  U
   n  O   [        U5      S-
  U:  a@  X#    SX#S-       3nXR                  R                  ;   a  U R                  R                  U   n[        U5      S-
  US-   :  aQ  SR                  X#   X#S-      X#S-      5      nXR                  R                  ;   a  U R                  R                  U   nXR                  R                  ;   d  X`R                  R                  ;   a  XR                  R
                  -   nU$ )Nr    z{} {} {}r   r   z{} {})formatr  r   r   r   r   )r   r   r   r   onezero
twoonezerotwoonethreetwoonethreetwo	sequencesseqzeroone
zeroonetwos                r   r  (SentimentIntensityAnalyzer._idioms_check  s   (Q/02E2H1IJ&&A&A&"

 (A./q1DU1K0LM ''A&A&A&
 >>A&(;E(B
 &xH	Cnn888..<<SA 
 "#a'!+,/02E!e2L1MNG..<<<..<<WE"#a'!a%/#**#&#E*#E*J
 ^^???..<<ZH 333444 5 55Gr   c                 t   US:X  a>  U R                   R                  X$S-
     /5      (       a  XR                   R                  -  nUS:X  ah  X$S-
     S:X  a  X$S-
     S:X  d  X$S-
     S:X  a  US-  nOAU R                   R                  X$US-   -
     /5      (       a  XR                   R                  -  nUS:X  a  X$S-
     S:X  a  X$S-
     S:X  d!  X$S-
     S:X  d  X$S-
     S:X  d  X$S-
     S:X  a  US	-  nU$ U R                   R                  X$US-   -
     /5      (       a  XR                   R                  -  nU$ )
Nr   r   r   r   rg   thisr   r   g      ?)r  r   r   )r   r   r   r"  r   s        r   r  'SentimentIntensityAnalyzer._never_check  sS   a<~~%%':q5'A&BCC!NN$;$;;a<"q5)W4#E*d2&1u-7!C-'')<'A+=N)O(PQQ!NN$;$;;a<#E*g5'A.$6*q51V; (A.$6*q51V; "D.  '')<'A+=N)O(PQQ!NN$;$;;r   c                 R    U R                  U5      nU R                  U5      nX4-   nU$ r   )_amplify_ep_amplify_qm)r   sum_sr   ep_amplifierqm_amplifierpunct_emph_amplifiers         r   _punctuation_emphasis0SentimentIntensityAnalyzer._punctuation_emphasis$  s1    ''-''-+:##r   c                 B    UR                  S5      nUS:  a  SnUS-  nU$ )Nr      g㥛 ?count)r   r   ep_countrE  s       r   rB  &SentimentIntensityAnalyzer._amplify_ep+  s-    ::c?a<H  %'r   c                 V    UR                  S5      nSnUS:  a  US::  a  US-  nU$ SnU$ )Nr   r   r   r   g
ףp=
?gQ?rL  )r   r   qm_countrF  s       r   rC  &SentimentIntensityAnalyzer._amplify_qm5  sB    ::c?a<1}  ($   $r   c                     SnSnSnU H>  nUS:  a  U[        U5      S-   -  nUS:  a  U[        U5      S-
  -  nUS:X  d  M9  US-  nM@     X#U4$ )Nr   r   r   )r
  )r   r  pos_sumneg_sum	neu_countsentiment_scores         r   _sift_sentiment_scores1SentimentIntensityAnalyzer._sift_sentiment_scoresB  s{    	)O"/*Q. "/*Q. !#Q	  * **r   c                    U(       Ga  [        [        U5      5      nU R                  X25      nUS:  a  X4-  nO
US:  a  X4-  nU R                  R	                  U5      nU R                  U5      u  pgnU[        R                  " U5      :  a  Xd-  nOU[        R                  " U5      :  a  Xt-  nU[        R                  " U5      -   U-   n	[        R                  " Xi-  5      n
[        R                  " Xy-  5      n[        R                  " X-  5      nOSnSn
SnSn[        US5      [        US5      [        U
S5      [        US5      S.nU$ )Nr   r   r   rK  )negneuposcompound)	r
  sumrH  r  r   rX  r   fabsround)r   r  r   rD  rG  r^  rT  rU  rV  totalr]  r[  r\  sentiment_dicts                 r   r  (SentimentIntensityAnalyzer.score_valenceT  s2   #j/*E#'#=#=e#J qy--~~//6H*.*E*Ej*Q'Gi7++/499W--/dii009<E))GO,C))GO,C))I-.C HCCC a=a=a=h*	
 r   )r  r  r  N)z;sentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon.txt)r   r   r   r   r   r   r  r  r  r   r  r  r  rH  rB  rC  rX  r  r   r   r   r   r   r   K  sQ     S* 4D0d(
/b:$+$%r   r   )r   r   r   r   	itertoolsr   	nltk.datar   	nltk.utilr   r   r   r   r   r   r   <module>rh     sD      	    c cLA AHn nr   