class_docstr: Create a doc instance of text, obtain cleaned, readable text and
  metadata from this doc.
  
  Properties:
  raw: incoming, unedited text
  language: 2-letter code for the language of the text
  is_detected_language: is the language detected or specified beforehand
  is_reliable_language: is the language specified or was it reliably detected
  hint_language: language you expect your text to be
  _spacy_nlps: nested dictionary {lang: {model_id: model}} with loaded spacy language modules
docstr: Returns document embeddings based on the words in the document.
  
  >>> import numpy
  >>> from textpipe.doc import Doc
  >>> doc1 = Doc('a b')
  >>> doc2 = Doc('a a b')
  >>> numpy.array_equiv(doc1.aggregate_word_vectors(), doc1.aggregate_word_vectors())
  True
  >>> numpy.array_equiv(doc1.aggregate_word_vectors(), doc2.aggregate_word_vectors())
  False
  >>> numpy.array_equiv(doc1.aggregate_word_vectors(aggregation='mean'),
  ...                   doc2.aggregate_word_vectors(aggregation='sum'))
  False
  >>> numpy.array_equiv(doc1.aggregate_word_vectors(aggregation='mean'),
  ...                   doc2.aggregate_word_vectors(aggregation='var'))
  False
  >>> numpy.array_equiv(doc1.aggregate_word_vectors(aggregation='sum'),
  ...                   doc2.aggregate_word_vectors(aggregation='var'))
  False
  >>> doc = Doc('sentence with an out of vector word lsseofn')
  >>> len(doc.aggregate_word_vectors())
  96
  >>> numpy.array_equiv(doc.aggregate_word_vectors(exclude_oov=False),
  ...                   doc.aggregate_word_vectors(exclude_oov=True))
  False
docstr_tok: ["Returns","document","embeddings","based","on","the","words","in","the","document",".",">",">",">","import","numpy",">",">",">","from","textpipe.doc","import","Doc",">",">",">","doc1","=","Doc","(","'","a","b","'",")",">",">",">","doc2","=","Doc","(","'","a","a","b","'",")",">",">",">","numpy.array_equiv","(","doc1.aggregate_word_vectors","(",")",",","doc1.aggregate_word_vectors","(",")",")","True",">",">",">","numpy.array_equiv","(","doc1.aggregate_word_vectors","(",")",",","doc2.aggregate_word_vectors","(",")",")","False",">",">",">","numpy.array_equiv","(","doc1.aggregate_word_vectors","(","aggregation='mean","'",")",",","...","doc2.aggregate_word_vectors","(","aggregation='sum","'",")",")","False",">",">",">","numpy.array_equiv","(","doc1.aggregate_word_vectors","(","aggregation='mean","'",")",",","...","doc2.aggregate_word_vectors","(","aggregation='var","'",")",")","False",">",">",">","numpy.array_equiv","(","doc1.aggregate_word_vectors","(","aggregation='sum","'",")",",","...","doc2.aggregate_word_vectors","(","aggregation='var","'",")",")","False",">",">",">","doc","=","Doc","(","'sentence","with","an","out","of","vector","word","lsseofn","'",")",">",">",">","len","(","doc.aggregate_word_vectors","(",")",")","96",">",">",">","numpy.array_equiv","(","doc.aggregate_word_vectors","(","exclude_oov=False",")",",","...","doc.aggregate_word_vectors","(","exclude_oov=True",")",")","False"]
code: def aggregate_word_vectors(
      self,
      model_name=None,
      aggregation="mean",
      normalize=False,
      exclude_oov=False,
  ):
      """
      Returns document embeddings based on the words in the document.
  
      >>> import numpy
      >>> from textpipe.doc import Doc
      >>> doc1 = Doc('a b')
      >>> doc2 = Doc('a a b')
      >>> numpy.array_equiv(doc1.aggregate_word_vectors(), doc1.aggregate_word_vectors())
      True
      >>> numpy.array_equiv(doc1.aggregate_word_vectors(), doc2.aggregate_word_vectors())
      False
      >>> numpy.array_equiv(doc1.aggregate_word_vectors(aggregation='mean'),
      ...                   doc2.aggregate_word_vectors(aggregation='sum'))
      False
      >>> numpy.array_equiv(doc1.aggregate_word_vectors(aggregation='mean'),
      ...                   doc2.aggregate_word_vectors(aggregation='var'))
      False
      >>> numpy.array_equiv(doc1.aggregate_word_vectors(aggregation='sum'),
      ...                   doc2.aggregate_word_vectors(aggregation='var'))
      False
      >>> doc = Doc('sentence with an out of vector word lsseofn')
      >>> len(doc.aggregate_word_vectors())
      96
      >>> numpy.array_equiv(doc.aggregate_word_vectors(exclude_oov=False),
      ...                   doc.aggregate_word_vectors(exclude_oov=True))
      False
      """
      lang = (
          self.language
          if self.is_reliable_language
          else self.hint_language
      )
      tokens = [
          token
          for token in self._load_spacy_doc(lang, model_name)
          if not exclude_oov or not token.is_oov
      ]
      vectors = [
          token.vector / token.vector_norm
          if normalize
          else token.vector
          for token in tokens
      ]
  
      if aggregation == "mean":
          return numpy.mean(vectors, axis=0).tolist()
  
      if aggregation == "sum":
          return numpy.sum(vectors, axis=0).tolist()
  
      if aggregation == "var":
          return numpy.var(vectors, axis=0).tolist()
  
      raise NotImplementedError(
          f"Aggregation method {aggregation} is not implemented."
      )
  
imports: import functools
  import re
  import unicodedata
  from collections import Counter
  from urllib.parse import urlparse
  import cld2
  import numpy
  import spacy
  import spacy.matcher
  import textacy
  import textacy.ke
  import textacy.text_utils
  from bs4 import BeautifulSoup
  from datasketch import MinHash
  from gensim.models.keyedvectors import KeyedVectors
  from gensim.summarization.summarizer import summarize
  from textpipe.data.emoji import EMOJI_TO_UNICODE_NAME, EMOJI_TO_SENTIMENT
  from textpipe.wrappers import RedisKeyedVectors
  from textpipe.util import getattr_
label_desc: Use image node_id 29 for calling the Doc obj's underlying member method code with example usage: obj.aggregate_word_vectors(model_name, aggregation, normalize, exclude_oov) and returns: numpy, numpy, numpy