class_docstr: Stream a collection of Reddit comments from 1 or more compressed files on disk,
  either as texts or text + metadata pairs.
  
  Download the data (one time only!) or subsets thereof by specifying a date range::
  
      >>> import textacy.datasets
      >>> ds = textacy.datasets.RedditComments()
      >>> ds.download(date_range=("2007-10", "2008-03"))
      >>> ds.info
      {'name': 'reddit_comments',
       'site_url': 'https://archive.org/details/2015_reddit_comments_corpus',
       'description': 'Collection of ~1.5 billion publicly available Reddit comments from October 2007 through May 2015.'}
  
  Iterate over comments as texts or records with both text and metadata::
  
      >>> for text in ds.texts(limit=5):
      ...     print(text)
      >>> for text, meta in ds.records(limit=5):
      ...     print("\n{} {}\n{}".format(meta["author"], meta["created_utc"], text))
  
  Filter comments by a variety of metadata fields and text length::
  
      >>> for text, meta in ds.records(subreddit="politics", limit=5):
      ...     print(meta["score"], ":", text)
      >>> for text, meta in ds.records(date_range=("2008-01", "2008-03"), limit=5):
      ...     print(meta["created_utc"])
      >>> for text, meta in ds.records(score_range=(10, None), limit=5):
      ...     print(meta["score"], ":", text)
      >>> for text in ds.texts(min_len=2000, limit=5):
      ...     print(len(text))
  
  Stream comments into a :class:`textacy.Corpus <textacy.corpus.Corpus>`::
  
      >>> textacy.Corpus("en", data=ds.records(limit=1000))
      Corpus(1000 docs; 27582 tokens)
  
  Args:
      data_dir: Path to directory on disk under which the data is stored,
          i.e. ``/path/to/data_dir/reddit_comments``. Each file covers a given month,
          as indicated in the filename like "YYYY/RC_YYYY-MM.bz2".
  
  Attributes:
      full_date_range: First and last dates for which comments
          are available, each as an ISO-formatted string (YYYY-MM-DD).
class_docstr_tok: ["Stream","a","collection","of","Reddit","comments","from","1","or","more","compressed","files","on","disk",",","either","as","texts","or","text","+","metadata","pairs",".","Download","the","data","(","one","time","only","!",")","or","subsets","thereof","by","specifying","a","date","range",":",":",">",">",">","import","textacy.datasets",">",">",">","ds","=","textacy.datasets.RedditComments","(",")",">",">",">","ds.download","(","date_range=","(","``","2007-10","''",",","``","2008-03","''",")",")",">",">",">","ds.info","{","'name","'",":","'reddit_comments","'",",","'site_url","'",":","'https",":","\/\/archive.org\/details\/2015_reddit_comments_corpus","'",",","'description","'",":","'Collection","of","~1.5","billion","publicly","available","Reddit","comments","from","October","2007","through","May","2015",".","'","}","Iterate","over","comments","as","texts","or","records","with","both","text","and","metadata",":",":",">",">",">","for","text","in","ds.texts","(","limit=5",")",":","...","print","(","text",")",">",">",">","for","text",",","meta","in","ds.records","(","limit=5",")",":","...","print","(","``","\\n","{","}","{","}","\\n","{","}","''",".format","(","meta","[","``","author","''","]",",","meta","[","``","created_utc","''","]",",","text",")",")","Filter","comments","by","a","variety","of","metadata","fields","and","text","length",":",":",">",">",">","for","text",",","meta","in","ds.records","(","subreddit=","''","politics","''",",","limit=5",")",":","...","print","(","meta","[","``","score","''","]",",","``",":","''",",","text",")",">",">",">","for","text",",","meta","in","ds.records","(","date_range=","(","``","2008-01","''",",","``","2008-03","''",")",",","limit=5",")",":","...","print","(","meta","[","``","created_utc","''","]",")",">",">",">","for","text",",","meta","in","ds.records","(","score_range=","(","10",",","None",")",",","limit=5",")",":","...","print","(","meta","[","``","score","''","]",",","``",":","''",",","text",")",">",">",">","for","text","in","ds.texts","(","min_len=2000",",","limit=5",")",":","...","print","(","len","(","text",")",")","Stream","comments","into","a",":","class",":","`","textacy.Corpus","<","textacy.corpus.Corpus",">","`",":",":",">",">",">","textacy.Corpus","(","``","en","''",",","data=ds.records","(","limit=1000",")",")","Corpus","(","1000","docs",";","27582","tokens",")","Args",":","data_dir",":","Path","to","directory","on","disk","under","which","the","data","is","stored",",","i.e",".","``","\/path\/to\/data_dir\/reddit_comments","``",".","Each","file","covers","a","given","month",",","as","indicated","in","the","filename","like","``","YYYY\/RC_YYYY-MM.bz2","''",".","Attributes",":","full_date_range",":","First","and","last","dates","for","which","comments","are","available",",","each","as","an","ISO-formatted","string","(","YYYY-MM-DD",")","."]
docstr: Download 1 or more monthly Reddit comments files from archive.org
  and save them to disk under the ``data_dir`` directory.
  
  Args:
      date_range: Interval specifying the [start, end) dates for which
          comments files will be downloaded. Each item must be a str
          formatted as YYYY-MM or YYYY-MM-DD (the latter is converted
          to the corresponding YYYY-MM value). Both start and end values
          must be specified, but a null value for either is automatically
          replaced by the minimum or maximum valid values, respectively.
      force: If True, download the dataset, even if it already
          exists on disk under ``data_dir``.
docstr_tok: ["Download","1","or","more","monthly","Reddit","comments","files","from","archive.org","and","save","them","to","disk","under","the","``","data_dir","``","directory",".","Args",":","date_range",":","Interval","specifying","the","[","start",",","end",")","dates","for","which","comments","files","will","be","downloaded",".","Each","item","must","be","a","str","formatted","as","YYYY-MM","or","YYYY-MM-DD","(","the","latter","is","converted","to","the","corresponding","YYYY-MM","value",")",".","Both","start","and","end","values","must","be","specified",",","but","a","null","value","for","either","is","automatically","replaced","by","the","minimum","or","maximum","valid","values",",","respectively",".","force",":","If","True",",","download","the","dataset",",","even","if","it","already","exists","on","disk","under","``","data_dir","``","."]
code: def download(
      self,
      *,
      date_range: tuple[Optional[str], Optional[str]] = (None, None),
      force: bool = False,
  ) -> None:
      """
      Download 1 or more monthly Reddit comments files from archive.org
      and save them to disk under the ``data_dir`` directory.
  
      Args:
          date_range: Interval specifying the [start, end) dates for which
              comments files will be downloaded. Each item must be a str
              formatted as YYYY-MM or YYYY-MM-DD (the latter is converted
              to the corresponding YYYY-MM value). Both start and end values
              must be specified, but a null value for either is automatically
              replaced by the minimum or maximum valid values, respectively.
          force: If True, download the dataset, even if it already
              exists on disk under ``data_dir``.
      """
      date_range = utils.validate_and_clip_range(
          date_range, self.full_date_range, val_type=(str, bytes)
      )
      filestubs = self._generate_filestubs(date_range)
      for filestub in filestubs:
          tio.download_file(
              urllib.parse.urljoin(DOWNLOAD_ROOT, filestub),
              filename=filestub,
              dirpath=self.data_dir,
              force=force,
          )
  
imports: from __future__ import annotations
  import itertools
  import logging
  import re
  import urllib.parse
  from datetime import datetime
  from typing import ClassVar, Iterable, Optional
  from ..None import constants
  from ..None import io
  from ..None import types, utils
  from .base import Dataset
label_desc: Use image node_id 3 for calling the RedditComments obj's underlying member method code with example usage: obj.download() without return types