docstr: Build vocabulary from a sequence of documents (can be a once-only generator stream).
  
  Parameters
  ----------
  documents : iterable of list of :class:`~gensim.models.doc2vec.TaggedDocument`, optional
      Can be simply a list of :class:`~gensim.models.doc2vec.TaggedDocument` elements, but for larger corpora,
      consider an iterable that streams the documents directly from disk/network.
      See :class:`~gensim.models.doc2vec.TaggedBrownCorpus` or :class:`~gensim.models.doc2vec.TaggedLineDocument`
  corpus_file : str, optional
      Path to a corpus file in :class:`~gensim.models.word2vec.LineSentence` format.
      You may use this argument instead of `documents` to get performance boost. Only one of `documents` or
      `corpus_file` arguments need to be passed (not both of them). Documents' tags are assigned automatically
      and are equal to a line number, as in :class:`~gensim.models.doc2vec.TaggedLineDocument`.
  update : bool
      If true, the new words in `documents` will be added to model's vocab.
  progress_per : int
      Indicates how many words to process before showing/updating the progress.
  keep_raw_vocab : bool
      If not true, delete the raw vocabulary after the scaling is done and free up RAM.
  trim_rule : function, optional
      Vocabulary trimming rule, specifies whether certain words should remain in the vocabulary,
      be trimmed away, or handled using the default (discard if word count < min_count).
      Can be None (min_count will be used, look to :func:`~gensim.utils.keep_vocab_item`),
      or a callable that accepts parameters (word, count, min_count) and returns either
      :attr:`gensim.utils.RULE_DISCARD`, :attr:`gensim.utils.RULE_KEEP` or :attr:`gensim.utils.RULE_DEFAULT`.
      The rule, if given, is only used to prune vocabulary during current method call and is not stored as part
      of the model.
  
      The input parameters are of the following types:
          * `word` (str) - the word we are examining
          * `count` (int) - the word's frequency count in the corpus
          * `min_count` (int) - the minimum count threshold.
  
  **kwargs
      Additional key word arguments passed to the internal vocabulary construction.
code: def build_vocab(
      self,
      corpus_iterable=None,
      corpus_file=None,
      update=False,
      progress_per=10000,
      keep_raw_vocab=False,
      trim_rule=None,
      **kwargs,
  ):
      """Build vocabulary from a sequence of documents (can be a once-only generator stream).
  
      Parameters
      ----------
      documents : iterable of list of :class:`~gensim.models.doc2vec.TaggedDocument`, optional
          Can be simply a list of :class:`~gensim.models.doc2vec.TaggedDocument` elements, but for larger corpora,
          consider an iterable that streams the documents directly from disk/network.
          See :class:`~gensim.models.doc2vec.TaggedBrownCorpus` or :class:`~gensim.models.doc2vec.TaggedLineDocument`
      corpus_file : str, optional
          Path to a corpus file in :class:`~gensim.models.word2vec.LineSentence` format.
          You may use this argument instead of `documents` to get performance boost. Only one of `documents` or
          `corpus_file` arguments need to be passed (not both of them). Documents' tags are assigned automatically
          and are equal to a line number, as in :class:`~gensim.models.doc2vec.TaggedLineDocument`.
      update : bool
          If true, the new words in `documents` will be added to model's vocab.
      progress_per : int
          Indicates how many words to process before showing/updating the progress.
      keep_raw_vocab : bool
          If not true, delete the raw vocabulary after the scaling is done and free up RAM.
      trim_rule : function, optional
          Vocabulary trimming rule, specifies whether certain words should remain in the vocabulary,
          be trimmed away, or handled using the default (discard if word count < min_count).
          Can be None (min_count will be used, look to :func:`~gensim.utils.keep_vocab_item`),
          or a callable that accepts parameters (word, count, min_count) and returns either
          :attr:`gensim.utils.RULE_DISCARD`, :attr:`gensim.utils.RULE_KEEP` or :attr:`gensim.utils.RULE_DEFAULT`.
          The rule, if given, is only used to prune vocabulary during current method call and is not stored as part
          of the model.
  
          The input parameters are of the following types:
              * `word` (str) - the word we are examining
              * `count` (int) - the word's frequency count in the corpus
              * `min_count` (int) - the minimum count threshold.
  
      **kwargs
          Additional key word arguments passed to the internal vocabulary construction.
  
      """
      total_words, corpus_count = self.scan_vocab(
          corpus_iterable=corpus_iterable,
          corpus_file=corpus_file,
          progress_per=progress_per,
          trim_rule=trim_rule,
      )
      self.corpus_count = corpus_count
      self.corpus_total_words = total_words
      report_values = self.prepare_vocab(
          update=update,
          keep_raw_vocab=keep_raw_vocab,
          trim_rule=trim_rule,
          **kwargs,
      )
  
      report_values["memory"] = self.estimate_memory(
          vocab_size=report_values["num_retained_words"]
      )
      self.prepare_weights(update=update)
  
imports: import logging
  import os
  from collections import namedtuple, defaultdict
  from collections.abc import Iterable
  from timeit import default_timer
  from dataclasses import dataclass
  from numpy import zeros, float32, vstack, integer, dtype
  import numpy
  from gensim import utils, matutils
  from gensim.utils import deprecated
  from gensim.models import Word2Vec, FAST_VERSION
  from gensim.models.keyedvectors import KeyedVectors, pseudorandom_weak_vector
label_desc: Use image node_id 22 for calling the Doc2Vec obj's underlying member method code with example usage: obj.build_vocab(corpus_iterable, corpus_file, update, progress_per, keep_raw_vocab, trim_rule) without return types