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: Iterate over comments (including text and metadata) in 1 or more files
  of this dataset, optionally filtering by a variety of metadata and/or
  text length, in chronological order.
  
  Args:
      subreddit: Filter comments for those which were posted
          in the specified subreddit(s).
      date_range: Filter comments for those which were posted
          within the interval [start, end). Each item must be a str in
          ISO-standard format, i.e. some amount of YYYY-MM-DDTHH:mm:ss.
          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.
      score_range: Filter comments for those whose score
          (# upvotes minus # downvotes) is within the interval [low, high).
          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.
      min_len: Filter comments for those whose body length in chars is
          at least this long.
      limit: Maximum number of comments passing all filters to yield.
          If None, all comments are iterated over.
  
  Yields:
      Text of the next comment in dataset passing all filters,
      and its corresponding metadata.
  
  Raises:
      ValueError: If any filtering options are invalid.
docstr_tok: ["Iterate","over","comments","(","including","text","and","metadata",")","in","1","or","more","files","of","this","dataset",",","optionally","filtering","by","a","variety","of","metadata","and\/or","text","length",",","in","chronological","order",".","Args",":","subreddit",":","Filter","comments","for","those","which","were","posted","in","the","specified","subreddit","(","s",")",".","date_range",":","Filter","comments","for","those","which","were","posted","within","the","interval","[","start",",","end",")",".","Each","item","must","be","a","str","in","ISO-standard","format",",","i.e",".","some","amount","of","YYYY-MM-DDTHH",":","mm",":","ss",".","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",".","score_range",":","Filter","comments","for","those","whose","score","(","#","upvotes","minus","#","downvotes",")","is","within","the","interval","[","low",",","high",")",".","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",".","min_len",":","Filter","comments","for","those","whose","body","length","in","chars","is","at","least","this","long",".","limit",":","Maximum","number","of","comments","passing","all","filters","to","yield",".","If","None",",","all","comments","are","iterated","over",".","Yields",":","Text","of","the","next","comment","in","dataset","passing","all","filters",",","and","its","corresponding","metadata",".","Raises",":","ValueError",":","If","any","filtering","options","are","invalid","."]
code: def records(
      self,
      *,
      subreddit: Optional[str | set[str]] = None,
      date_range: Optional[tuple[Optional[str], Optional[str]]] = None,
      score_range: Optional[tuple[Optional[int], Optional[int]]] = None,
      min_len: Optional[int] = None,
      limit: Optional[int] = None,
  ) -> Iterable[types.Record]:
      """
      Iterate over comments (including text and metadata) in 1 or more files
      of this dataset, optionally filtering by a variety of metadata and/or
      text length, in chronological order.
  
      Args:
          subreddit: Filter comments for those which were posted
              in the specified subreddit(s).
          date_range: Filter comments for those which were posted
              within the interval [start, end). Each item must be a str in
              ISO-standard format, i.e. some amount of YYYY-MM-DDTHH:mm:ss.
              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.
          score_range: Filter comments for those whose score
              (# upvotes minus # downvotes) is within the interval [low, high).
              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.
          min_len: Filter comments for those whose body length in chars is
              at least this long.
          limit: Maximum number of comments passing all filters to yield.
              If None, all comments are iterated over.
  
      Yields:
          Text of the next comment in dataset passing all filters,
          and its corresponding metadata.
  
      Raises:
          ValueError: If any filtering options are invalid.
      """
      self._date_range = date_range  # used to limit files iterated
      try:
          filters = self._get_filters(
              subreddit, date_range, score_range, min_len
          )
          for record in itertools.islice(
              self._filtered_iter(filters), limit
          ):
              yield types.Record(text=record.pop("body"), meta=record)
      finally:
          self._date_range = None
  
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 11 for calling the RedditComments obj's underlying member method code with example usage: obj.records() without return types