class_docstr: Stream a collection of Congressional speeches from a compressed json file on disk,
  either as texts or text + metadata pairs.
  
  Download the data (one time only!) from the textacy-data repo
  (https://github.com/bdewilde/textacy-data), and save its contents to disk::
  
      >>> import textacy.datasets
      >>> ds = textacy.datasets.CapitolWords()
      >>> ds.download()
      >>> ds.info
      {'name': 'capitol_words',
       'site_url': 'http://sunlightlabs.github.io/Capitol-Words/',
       'description': 'Collection of ~11k speeches in the Congressional Record given by notable U.S. politicians between Jan 1996 and Jun 2016.'}
  
  Iterate over speeches as texts or records with both text and metadata::
  
      >>> for text in ds.texts(limit=3):
      ...     print(text, end="\n\n")
      >>> for text, meta in ds.records(limit=3):
      ...     print("\n{} ({})\n{}".format(meta["title"], meta["speaker_name"], text))
  
  Filter speeches by a variety of metadata fields and text length::
  
      >>> for text, meta in ds.records(speaker_name="Bernie Sanders", limit=3):
      ...     print("\n{}, {}\n{}".format(meta["title"], meta["date"], text))
      >>> for text, meta in ds.records(speaker_party="D", congress={110, 111, 112},
      ...                          chamber="Senate", limit=3):
      ...     print(meta["title"], meta["speaker_name"], meta["date"])
      >>> for text, meta in ds.records(speaker_name={"Barack Obama", "Hillary Clinton"},
      ...                              date_range=("2005-01-01", "2005-12-31")):
      ...     print(meta["title"], meta["speaker_name"], meta["date"])
      >>> for text in ds.texts(min_len=50000):
      ...     print(len(text))
  
  Stream speeches into a :class:`textacy.Corpus <textacy.corpus.Corpus>`::
  
      >>> textacy.Corpus("en", data=ota.records(limit=100))
      Corpus(100 docs; 70496 tokens)
  
  Args:
      data_dir: Path to directory on disk under which dataset is stored,
          i.e. ``/path/to/data_dir/capitol_words``.
  
  Attributes:
      full_date_range: First and last dates for which speeches are available,
          each as an ISO-formatted string (YYYY-MM-DD).
      speaker_names: Full names of all speakers included in corpus, e.g. "Bernie Sanders".
      speaker_parties: All distinct political parties of speakers, e.g. "R".
      chambers: All distinct chambers in which speeches were given, e.g. "House".
      congresses: All distinct numbers of the congresses in which speeches were given, e.g. 114.
class_docstr_tok: ["Stream","a","collection","of","Congressional","speeches","from","a","compressed","json","file","on","disk",",","either","as","texts","or","text","+","metadata","pairs",".","Download","the","data","(","one","time","only","!",")","from","the","textacy-data","repo","(","https",":","\/\/github.com\/bdewilde\/textacy-data",")",",","and","save","its","contents","to","disk",":",":",">",">",">","import","textacy.datasets",">",">",">","ds","=","textacy.datasets.CapitolWords","(",")",">",">",">","ds.download","(",")",">",">",">","ds.info","{","'name","'",":","'capitol_words","'",",","'site_url","'",":","'http",":","\/\/sunlightlabs.github.io\/Capitol-Words\/","'",",","'description","'",":","'Collection","of","~11k","speeches","in","the","Congressional","Record","given","by","notable","U.S.","politicians","between","Jan","1996","and","Jun","2016",".","'","}","Iterate","over","speeches","as","texts","or","records","with","both","text","and","metadata",":",":",">",">",">","for","text","in","ds.texts","(","limit=3",")",":","...","print","(","text",",","end=","''","\\n\\n","''",")",">",">",">","for","text",",","meta","in","ds.records","(","limit=3",")",":","...","print","(","``","\\n","{","}","(","{","}",")","\\n","{","}","''",".format","(","meta","[","``","title","''","]",",","meta","[","``","speaker_name","''","]",",","text",")",")","Filter","speeches","by","a","variety","of","metadata","fields","and","text","length",":",":",">",">",">","for","text",",","meta","in","ds.records","(","speaker_name=","''","Bernie","Sanders","''",",","limit=3",")",":","...","print","(","``","\\n","{","}",",","{","}","\\n","{","}","''",".format","(","meta","[","``","title","''","]",",","meta","[","``","date","''","]",",","text",")",")",">",">",">","for","text",",","meta","in","ds.records","(","speaker_party=","''","D","''",",","congress=","{","110",",","111",",","112","}",",","...","chamber=","''","Senate","''",",","limit=3",")",":","...","print","(","meta","[","``","title","''","]",",","meta","[","``","speaker_name","''","]",",","meta","[","``","date","''","]",")",">",">",">","for","text",",","meta","in","ds.records","(","speaker_name=","{","``","Barack","Obama","''",",","``","Hillary","Clinton","''","}",",","...","date_range=","(","``","2005-01-01","''",",","``","2005-12-31","''",")",")",":","...","print","(","meta","[","``","title","''","]",",","meta","[","``","speaker_name","''","]",",","meta","[","``","date","''","]",")",">",">",">","for","text","in","ds.texts","(","min_len=50000",")",":","...","print","(","len","(","text",")",")","Stream","speeches","into","a",":","class",":","`","textacy.Corpus","<","textacy.corpus.Corpus",">","`",":",":",">",">",">","textacy.Corpus","(","``","en","''",",","data=ota.records","(","limit=100",")",")","Corpus","(","100","docs",";","70496","tokens",")","Args",":","data_dir",":","Path","to","directory","on","disk","under","which","dataset","is","stored",",","i.e",".","``","\/path\/to\/data_dir\/capitol_words","``",".","Attributes",":","full_date_range",":","First","and","last","dates","for","which","speeches","are","available",",","each","as","an","ISO-formatted","string","(","YYYY-MM-DD",")",".","speaker_names",":","Full","names","of","all","speakers","included","in","corpus",",","e.g",".","``","Bernie","Sanders","''",".","speaker_parties",":","All","distinct","political","parties","of","speakers",",","e.g",".","``","R","''",".","chambers",":","All","distinct","chambers","in","which","speeches","were","given",",","e.g",".","``","House","''",".","congresses",":","All","distinct","numbers","of","the","congresses","in","which","speeches","were","given",",","e.g",".","114","."]
code: def __init__(
      self,
      data_dir: types.PathLike = constants.DEFAULT_DATA_DIR.joinpath(
          NAME
      ),
  ):
      super().__init__(NAME, meta=META)
      self.data_dir = utils.to_path(data_dir).resolve()
      self._filename = "capitol-words-py3.json.gz"
      self._filepath = self.data_dir.joinpath(self._filename)
  
file_path: textacy/src/textacy/datasets/capitol_words.py
imports: from __future__ import annotations
  import itertools
  import logging
  import urllib.parse
  from typing import Any, Callable, 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 1 to create a new CapitolWords object from inherited base classes: Dataset with example: obj = CapitolWords(data_dir)