class_docstr: Read documents recursively from a directory.
  Each file/line (depends on `lines_are_documents`) is interpreted as a plain text document.
class_docstr_tok: ["Read","documents","recursively","from","a","directory",".","Each","file\/line","(","depends","on","`","lines_are_documents","`",")","is","interpreted","as","a","plain","text","document","."]
docstr: Parameters
  ----------
  input : str
      Path to input file/folder.
  dictionary : :class:`~gensim.corpora.dictionary.Dictionary`, optional
      If a dictionary is provided, it will not be updated with the given corpus on initialization.
      If None - new dictionary will be built for the given corpus.
      If `input` is None, the dictionary will remain uninitialized.
  metadata : bool, optional
      If True - yield metadata with each document.
  min_depth : int, optional
      Minimum depth in directory tree at which to begin searching for files.
  max_depth : int, optional
      Max depth in directory tree at which files will no longer be considered.
      If None - not limited.
  pattern : str, optional
      Regex to use for file name inclusion, all those files *not* matching this pattern will be ignored.
  exclude_pattern : str, optional
      Regex to use for file name exclusion, all files matching this pattern will be ignored.
  lines_are_documents : bool, optional
      If True - each line is considered a document, otherwise - each file is one document.
  encoding : str, optional
      Encoding used to read the specified file or files in the specified directory.
  kwargs: keyword arguments passed through to the `TextCorpus` constructor.
      See :meth:`gemsim.corpora.textcorpus.TextCorpus.__init__` docstring for more details on these.
docstr_tok: ["Parameters","--","--","--","--","--","input",":","str","Path","to","input","file\/folder",".","dictionary",":",":","class",":","`","~gensim.corpora.dictionary.Dictionary","`",",","optional","If","a","dictionary","is","provided",",","it","will","not","be","updated","with","the","given","corpus","on","initialization",".","If","None","-","new","dictionary","will","be","built","for","the","given","corpus",".","If","`","input","`","is","None",",","the","dictionary","will","remain","uninitialized",".","metadata",":","bool",",","optional","If","True","-","yield","metadata","with","each","document",".","min_depth",":","int",",","optional","Minimum","depth","in","directory","tree","at","which","to","begin","searching","for","files",".","max_depth",":","int",",","optional","Max","depth","in","directory","tree","at","which","files","will","no","longer","be","considered",".","If","None","-","not","limited",".","pattern",":","str",",","optional","Regex","to","use","for","file","name","inclusion",",","all","those","files","*","not","*","matching","this","pattern","will","be","ignored",".","exclude_pattern",":","str",",","optional","Regex","to","use","for","file","name","exclusion",",","all","files","matching","this","pattern","will","be","ignored",".","lines_are_documents",":","bool",",","optional","If","True","-","each","line","is","considered","a","document",",","otherwise","-","each","file","is","one","document",".","encoding",":","str",",","optional","Encoding","used","to","read","the","specified","file","or","files","in","the","specified","directory",".","kwargs",":","keyword","arguments","passed","through","to","the","`","TextCorpus","`","constructor",".","See",":","meth",":","`","gemsim.corpora.textcorpus.TextCorpus.__init__","`","docstring","for","more","details","on","these","."]
code: def __init__(
      self,
      input,
      dictionary=None,
      metadata=False,
      min_depth=0,
      max_depth=None,
      pattern=None,
      exclude_pattern=None,
      lines_are_documents=False,
      encoding="utf-8",
      **kwargs,
  ):
      """
  
      Parameters
      ----------
      input : str
          Path to input file/folder.
      dictionary : :class:`~gensim.corpora.dictionary.Dictionary`, optional
          If a dictionary is provided, it will not be updated with the given corpus on initialization.
          If None - new dictionary will be built for the given corpus.
          If `input` is None, the dictionary will remain uninitialized.
      metadata : bool, optional
          If True - yield metadata with each document.
      min_depth : int, optional
          Minimum depth in directory tree at which to begin searching for files.
      max_depth : int, optional
          Max depth in directory tree at which files will no longer be considered.
          If None - not limited.
      pattern : str, optional
          Regex to use for file name inclusion, all those files *not* matching this pattern will be ignored.
      exclude_pattern : str, optional
          Regex to use for file name exclusion, all files matching this pattern will be ignored.
      lines_are_documents : bool, optional
          If True - each line is considered a document, otherwise - each file is one document.
      encoding : str, optional
          Encoding used to read the specified file or files in the specified directory.
      kwargs: keyword arguments passed through to the `TextCorpus` constructor.
          See :meth:`gemsim.corpora.textcorpus.TextCorpus.__init__` docstring for more details on these.
  
      """
      self._min_depth = min_depth
      self._max_depth = sys.maxsize if max_depth is None else max_depth
      self.pattern = pattern
      self.exclude_pattern = exclude_pattern
      self.lines_are_documents = lines_are_documents
      self.encoding = encoding
      super(TextDirectoryCorpus, self).__init__(
          input, dictionary, metadata, **kwargs
      )
  
imports: from __future__ import with_statement
  import logging
  import os
  import random
  import re
  import sys
  from gensim import interfaces, utils
  from gensim.corpora.dictionary import Dictionary
  from gensim.parsing.preprocessing import remove_stopword_tokens, remove_short_tokens, lower_to_unicode, strip_multiple_whitespaces
  from gensim.utils import deaccent, simple_tokenize
  from smart_open import open
label_desc: Use image node_id 1 to create a new TextDirectoryCorpus object from inherited base classes: TextCorpus with example: obj = TextDirectoryCorpus(input, dictionary, metadata, min_depth, max_depth, pattern, exclude_pattern, lines_are_documents, encoding)