+
    ÖÇÜhx  ã                   ó\   € R t ^ RIt^ RIt^ RIHt ^ RIHtHtHt ^ RI	H
t
  ! R R]4      tR# )z{
A reader for corpora that consist of Tweets. It is assumed that the Tweets
have been serialised into line-delimited JSON.
N)ÚCorpusReader)ÚStreamBackedCorpusViewÚZipFilePathPointerÚconcat)ÚTweetTokenizerc                   óh   a € ] tR t^t o Rt]t R]! 4       R3R ltR
R lt	R
R lt
R
R ltR tR	tV tR# )ÚTwitterCorpusReaderaç  
Reader for corpora that consist of Tweets represented as a list of line-delimited JSON.

Individual Tweets can be tokenized using the default tokenizer, or by a
custom tokenizer specified as a parameter to the constructor.

Construct a new Tweet corpus reader for a set of documents
located at the given root directory.

If you made your own tweet collection in a directory called
`twitter-files`, then you can initialise the reader as::

    from nltk.corpus import TwitterCorpusReader
    reader = TwitterCorpusReader(root='/path/to/twitter-files', '.*\.json')

However, the recommended approach is to set the relevant directory as the
value of the environmental variable `TWITTER`, and then invoke the reader
as follows::

   root = os.environ['TWITTER']
   reader = TwitterCorpusReader(root, '.*\.json')

If you want to work directly with the raw Tweets, the `json` library can
be used::

   import json
   for tweet in reader.docs():
       print(json.dumps(tweet, indent=1, sort_keys=True))

NÚutf8c                ó  € \         P                  ! WW$4       V P                  V P                  4       FN  p\	        V\
        4      '       d   K  \        P                  P                  V4      ^ 8X  g   KA  \        RV R24      h	   W0n
        R# )z÷
:param root: The root directory for this corpus.
:param fileids: A list or regexp specifying the fileids in this corpus.
:param word_tokenizer: Tokenizer for breaking the text of Tweets into
    smaller units, including but not limited to words.
zFile z	 is emptyN)r   Ú__init__ÚabspathsÚ_fileidsÚ
isinstancer   ÚosÚpathÚgetsizeÚ
ValueErrorÚ_word_tokenizer)ÚselfÚrootÚfileidsÚword_tokenizerÚencodingr   s   &&&&& Ú</usr/lib/python3/dist-packages/nltk/corpus/reader/twitter.pyr   ÚTwitterCorpusReader.__init__:   sq   € ô 	×Ò˜d¨'Ô<à—M‘M $§-¡-Ö0ˆDÜ˜$Ô 2×3Ò3ÙÜ—‘—‘ Ó&¨!Ö+Ü  5¨¨¨iÐ!8Ó9Ð9ñ	 1ð
 	Fà-Öó    c                ó¬   € \        V P                  VRR4       UUUu. uF#  w  r#pV P                  W P                  VR7      NK%  	  uppp4      # u upppi )zð
Returns the full Tweet objects, as specified by `Twitter
documentation on Tweets
<https://dev.twitter.com/docs/platform-objects/tweets>`_

:return: the given file(s) as a list of dictionaries deserialised
    from JSON.
:rtype: list(dict)
T)r   )r   r   Ú
CorpusViewÚ_read_tweets)r   r   r   ÚencÚfileids   &&   r   ÚdocsÚTwitterCorpusReader.docsN   sX   € ô ð ,0¯=©=¸À$ÈÔ+Mõá+MÑ'�T ð —‘ ×&7Ñ&7À#�ÖFÙ+Móó
ð 	
ùôs   �)Ac                óú   € V P                  V4      p. pV FO  p VR,          p\        V\        4      '       d   VP                  V P                  4      pVP                  V4       KQ  	  V#   \         d     Kc  i ; i)z{
Returns only the text content of Tweets in the file(s)

:return: the given file(s) as a list of Tweets.
:rtype: list(str)
Útext)r!   r   ÚbytesÚdecoder   ÚappendÚKeyError)r   r   Ú
fulltweetsÚtweetsÚjsonor$   s   &&    r   ÚstringsÚTwitterCorpusReader.strings_   su   € ð —Y‘Y˜wÓ'ˆ
ØˆÛˆEðØ˜V•}�Ü˜d¤E×*Ò*ØŸ;™; t§}¡}Ó5�DØ—‘˜dÖ#ñ  ð ˆøô ô Úðús   šAA+Á+A:Á9A:c                ó†   € V P                  V4      pV P                  pV Uu. uF  qCP                  V4      NK  	  up# u upi )z®
:return: the given file(s) as a list of the text content of Tweets as
    as a list of words, screenanames, hashtags, URLs and punctuation symbols.

:rtype: list(list(str))
)r,   r   Útokenize)r   r   r*   Ú	tokenizerÚts   &&   r   Ú	tokenizedÚTwitterCorpusReader.tokenizedr   s>   € ð —‘˜gÓ&ˆØ×(Ñ(ˆ	Ù/5Ó6©v¨!×"Ñ" 1Ö%©vÑ6Ð6ùÒ6s   ¢>c                ó´   € . p\        ^
4       FF  pVP                  4       pV'       g   Vu # \        P                  ! V4      pVP	                  V4       KH  	  V# )zC
Assumes that each line in ``stream`` is a JSON-serialised object.
)ÚrangeÚreadlineÚjsonÚloadsr'   )r   Ústreamr*   ÚiÚlineÚtweets   &&    r   r   Ú TwitterCorpusReader._read_tweets}   sL   € ð ˆÜ�r–ˆAØ—?‘?Ó$ˆDßØ’Ü—J’J˜tÓ$ˆEØ�M‰M˜%Ö ñ ð ˆr   )r   )N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r   r!   r,   r2   r   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r      s@   ø‡ € ñð> (€Jðð
 !±Ó1AÈFô.ô(
ô"ô&	7÷ð r   r   )rB   r7   r   Únltk.corpus.reader.apir   Únltk.corpus.reader.utilr   r   r   Únltk.tokenizer   r   © r   r   Ú<module>rJ      s,   ðñó
 Û 	å /ß VÑ VÝ (ôs˜,ö sr   