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",")","."]
code: def _clean_content(self, content: str) -> str:
      # strip out link markup, e.g. [foo](http://foo.com)
      content = RE_REDDIT_LINK.sub(r"\1", content)
      # clean up basic HTML cruft
      content = content.replace("&gt;", ">").replace("&lt;", "<")
      # strip out text markup, e.g. * for bold text
      content = (
          content.replace("`", "").replace("*", "").replace("~", "")
      )
      # normalize whitespace
      return constants.RE_NONBREAKING_SPACE.sub(
          " ", constants.RE_LINEBREAK.sub(r"\n", content)
      ).strip()
  
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 13 for calling the RedditComments obj's underlying member method code with example usage: obj._clean_content(content) and returns: constants