class_docstr: 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))
docstr: :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.
code: def __init__(
      self,
      root,
      fileids=None,
      word_tokenizer=TweetTokenizer(),
      encoding="utf8",
  ):
      """
      :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.
      """
      CorpusReader.__init__(self, root, fileids, encoding)
  
      for path in self.abspaths(self._fileids):
          if isinstance(path, ZipFilePathPointer):
              pass
          elif os.path.getsize(path) == 0:
              raise ValueError(f"File {path} is empty")
      """Check that all user-created corpus files are non-empty."""
  
      self._word_tokenizer = word_tokenizer
  
file_path: nltk/nltk/corpus/reader/twitter.py
imports: import json
  import os
  from nltk.corpus.reader.api import CorpusReader
  from nltk.corpus.reader.util import StreamBackedCorpusView, ZipFilePathPointer, concat
  from nltk.tokenize import TweetTokenizer
label_desc: Use image node_id 1 to create a new TwitterCorpusReader object from inherited base classes: CorpusReader with example: obj = TwitterCorpusReader(root, fileids, word_tokenizer, encoding)