class_docstr: Convert a collection of text documents to a matrix of token occurrences
  
  It turns a collection of text documents into a cupyx.scipy.sparse matrix
  holding token occurrence counts (or binary occurrence information),
  possibly normalized as token frequencies if norm='l1' or projected on the
  euclidean unit sphere if norm='l2'.
  
  This text vectorizer implementation uses the hashing trick to find the
  token string name to feature integer index mapping.
  
  This strategy has several advantages:
  
   - it is very low memory scalable to large datasets as there is no need to
     store a vocabulary dictionary in memory which is even more important
     as GPU's that are often memory constrained
   - it is fast to pickle and un-pickle as it holds no state besides the
     constructor parameters
   - it can be used in a streaming (partial fit) or parallel pipeline as
     there is no state computed during fit.
  
  There are also a couple of cons (vs using a CountVectorizer with an
  in-memory vocabulary):
  
   - there is no way to compute the inverse transform (from feature indices
     to string feature names) which can be a problem when trying to
     introspect which features are most important to a model.
   - there can be collisions: distinct tokens can be mapped to the same
     feature index. However in practice this is rarely an issue if n_features
     is large enough (e.g. 2 ** 18 for text classification problems).
   - no IDF weighting as this would render the transformer stateful.
  
  The hash function employed is the signed 32-bit version of Murmurhash3.
  
  Parameters
  ----------
  lowercase : bool, default=True
      Convert all characters to lowercase before tokenizing.
  preprocessor : callable or None (default)
      Override the preprocessing (string transformation) stage while
      preserving the tokenizing and n-grams generation steps.
  stop_words : string {'english'}, list, default=None
      If 'english', a built-in stop word list for English is used.
      There are several known issues with 'english' and you should
      consider an alternative.
      If a list, that list is assumed to contain stop words, all of which
      will be removed from the resulting tokens.
      Only applies if ``analyzer == 'word'``.
  ngram_range : tuple (min_n, max_n), default=(1, 1)
      The lower and upper boundary of the range of n-values for different
      word n-grams or char n-grams to be extracted. All values of n such
      such that min_n <= n <= max_n will be used. For example an
      ``ngram_range`` of ``(1, 1)`` means only unigrams, ``(1, 2)`` means
      unigrams and bigrams, and ``(2, 2)`` means only bigrams.
  analyzer : string, {'word', 'char', 'char_wb'}
      Whether the feature should be made of word n-gram or character
      n-grams.
      Option 'char_wb' creates character n-grams only from text inside
      word boundaries; n-grams at the edges of words are padded with space.
  n_features : int, default=(2 ** 20)
      The number of features (columns) in the output matrices. Small numbers
      of features are likely to cause hash collisions, but large numbers
      will cause larger coefficient dimensions in linear learners.
  binary : bool, default=False.
      If True, all non zero counts are set to 1. This is useful for discrete
      probabilistic models that model binary events rather than integer
      counts.
  norm : {'l1', 'l2'}, default='l2'
      Norm used to normalize term vectors. None for no normalization.
  alternate_sign : bool, default=True
      When True, an alternating sign is added to the features as to
      approximately conserve the inner product in the hashed space even for
      small n_features. This approach is similar to sparse random projection.
  dtype : type, optional
      Type of the matrix returned by fit_transform() or transform().
  delimiter : str, whitespace by default
      String used as a replacement for stop words if `stop_words` is not
      None. Typically the delimiting character between words is a good
      choice.
  
  Examples
  --------
  
  .. code-block:: python
  
      >>> from cuml.feature_extraction.text import HashingVectorizer
      >>> import pandas as pd
      >>> corpus = [
      ...     'This is the first document.',
      ...     'This document is the second document.',
      ...     'And this is the third one.',
      ...     'Is this the first document?',
      ... ]
      >>> vectorizer = HashingVectorizer(n_features=2**4)
      >>> X = vectorizer.fit_transform(pd.Series(corpus))
      >>> print(X.shape)
      (4, 16)
  
  See Also
  --------
  CountVectorizer, TfidfVectorizer
class_docstr_tok: ["Convert","a","collection","of","text","documents","to","a","matrix","of","token","occurrences","It","turns","a","collection","of","text","documents","into","a","cupyx.scipy.sparse","matrix","holding","token","occurrence","counts","(","or","binary","occurrence","information",")",",","possibly","normalized","as","token","frequencies","if","norm='l1","'","or","projected","on","the","euclidean","unit","sphere","if","norm='l2","'",".","This","text","vectorizer","implementation","uses","the","hashing","trick","to","find","the","token","string","name","to","feature","integer","index","mapping",".","This","strategy","has","several","advantages",":","-","it","is","very","low","memory","scalable","to","large","datasets","as","there","is","no","need","to","store","a","vocabulary","dictionary","in","memory","which","is","even","more","important","as","GPU","'s","that","are","often","memory","constrained","-","it","is","fast","to","pickle","and","un-pickle","as","it","holds","no","state","besides","the","constructor","parameters","-","it","can","be","used","in","a","streaming","(","partial","fit",")","or","parallel","pipeline","as","there","is","no","state","computed","during","fit",".","There","are","also","a","couple","of","cons","(","vs","using","a","CountVectorizer","with","an","in-memory","vocabulary",")",":","-","there","is","no","way","to","compute","the","inverse","transform","(","from","feature","indices","to","string","feature","names",")","which","can","be","a","problem","when","trying","to","introspect","which","features","are","most","important","to","a","model",".","-","there","can","be","collisions",":","distinct","tokens","can","be","mapped","to","the","same","feature","index",".","However","in","practice","this","is","rarely","an","issue","if","n_features","is","large","enough","(","e.g",".","2","*","*","18","for","text","classification","problems",")",".","-","no","IDF","weighting","as","this","would","render","the","transformer","stateful",".","The","hash","function","employed","is","the","signed","32-bit","version","of","Murmurhash3",".","Parameters","--","--","--","--","--","lowercase",":","bool",",","default=True","Convert","all","characters","to","lowercase","before","tokenizing",".","preprocessor",":","callable","or","None","(","default",")","Override","the","preprocessing","(","string","transformation",")","stage","while","preserving","the","tokenizing","and","n-grams","generation","steps",".","stop_words",":","string","{","'english","'","}",",","list",",","default=None","If","'english","'",",","a","built-in","stop","word","list","for","English","is","used",".","There","are","several","known","issues","with","'english","'","and","you","should","consider","an","alternative",".","If","a","list",",","that","list","is","assumed","to","contain","stop","words",",","all","of","which","will","be","removed","from","the","resulting","tokens",".","Only","applies","if","``","analyzer","==","'word","'","``",".","ngram_range",":","tuple","(","min_n",",","max_n",")",",","default=","(","1",",","1",")","The","lower","and","upper","boundary","of","the","range","of","n-values","for","different","word","n-grams","or","char","n-grams","to","be","extracted",".","All","values","of","n","such","such","that","min_n","<","=","n","<","=","max_n","will","be","used",".","For","example","an","``","ngram_range","``","of","``","(","1",",","1",")","``","means","only","unigrams",",","``","(","1",",","2",")","``","means","unigrams","and","bigrams",",","and","``","(","2",",","2",")","``","means","only","bigrams",".","analyzer",":","string",",","{","'word","'",",","'char","'",",","'char_wb","'","}","Whether","the","feature","should","be","made","of","word","n-gram","or","character","n-grams",".","Option","'char_wb","'","creates","character","n-grams","only","from","text","inside","word","boundaries",";","n-grams","at","the","edges","of","words","are","padded","with","space",".","n_features",":","int",",","default=","(","2","*","*","20",")","The","number","of","features","(","columns",")","in","the","output","matrices",".","Small","numbers","of","features","are","likely","to","cause","hash","collisions",",","but","large","numbers","will","cause","larger","coefficient","dimensions","in","linear","learners",".","binary",":","bool",",","default=False",".","If","True",",","all","non","zero","counts","are","set","to","1",".","This","is","useful","for","discrete","probabilistic","models","that","model","binary","events","rather","than","integer","counts",".","norm",":","{","'l1","'",",","'l2","'","}",",","default='l2'","Norm","used","to","normalize","term","vectors",".","None","for","no","normalization",".","alternate_sign",":","bool",",","default=True","When","True",",","an","alternating","sign","is","added","to","the","features","as","to","approximately","conserve","the","inner","product","in","the","hashed","space","even","for","small","n_features",".","This","approach","is","similar","to","sparse","random","projection",".","dtype",":","type",",","optional","Type","of","the","matrix","returned","by","fit_transform","(",")","or","transform","(",")",".","delimiter",":","str",",","whitespace","by","default","String","used","as","a","replacement","for","stop","words","if","`","stop_words","`","is","not","None",".","Typically","the","delimiting","character","between","words","is","a","good","choice",".","Examples","--","--","--","--","..","code-block",":",":","python",">",">",">","from","cuml.feature_extraction.text","import","HashingVectorizer",">",">",">","import","pandas","as","pd",">",">",">","corpus","=","[","...","'This","is","the","first","document",".","'",",","...","'This","document","is","the","second","document",".","'",",","...","'And","this","is","the","third","one",".","'",",","...","'Is","this","the","first","document","?","'",",","...","]",">",">",">","vectorizer","=","HashingVectorizer","(","n_features=2","*","*","4",")",">",">",">","X","=","vectorizer.fit_transform","(","pd.Series","(","corpus",")",")",">",">",">","print","(","X.shape",")","(","4",",","16",")","See","Also","--","--","--","--","CountVectorizer",",","TfidfVectorizer"]
docstr: Transform documents to document-term matrix.
  
  Extract token counts out of raw text documents using the vocabulary
  fitted with fit or the one provided to the constructor.
  
  Parameters
  ----------
  raw_documents : cudf.Series or pd.Series
      A Series of string documents
  
  Returns
  -------
  X : sparse CuPy CSR matrix of shape (n_samples, n_features)
      Document-term matrix.
docstr_tok: ["Transform","documents","to","document-term","matrix",".","Extract","token","counts","out","of","raw","text","documents","using","the","vocabulary","fitted","with","fit","or","the","one","provided","to","the","constructor",".","Parameters","--","--","--","--","--","raw_documents",":","cudf.Series","or","pd.Series","A","Series","of","string","documents","Returns","--","--","--","-","X",":","sparse","CuPy","CSR","matrix","of","shape","(","n_samples",",","n_features",")","Document-term","matrix","."]
code: def transform(self, raw_documents):
      """
      Transform documents to document-term matrix.
  
      Extract token counts out of raw text documents using the vocabulary
      fitted with fit or the one provided to the constructor.
  
      Parameters
      ----------
      raw_documents : cudf.Series or pd.Series
          A Series of string documents
  
      Returns
      -------
      X : sparse CuPy CSR matrix of shape (n_samples, n_features)
          Document-term matrix.
      """
      docs = self._preprocess(raw_documents)
      del raw_documents
      n_doc = len(docs)
      tokenized_df = self._create_tokenized_df(docs)
      del docs
      count_df = self._count_hash(tokenized_df)
      del tokenized_df
      empty_doc_ids = self._compute_empty_doc_ids(count_df, n_doc)
      X = create_csr_matrix_from_count_df(
          count_df,
          empty_doc_ids,
          n_doc,
          self.n_features,
          dtype=self.dtype,
      )
  
      if self.binary:
          X.data.fill(1)
      if self.norm:
          if self.norm == "l1":
              csr_row_normalize_l1(X, inplace=True)
          elif self.norm == "l2":
              csr_row_normalize_l2(X, inplace=True)
  
      return X
  
imports: from cuml.internals.safe_imports import cpu_only_import
  import cuml.internals.logger
  from cudf.utils.dtypes import min_signed_type
  from cuml.internals.type_utils import CUPY_SPARSE_DTYPES
  import numbers
  from cuml.internals.safe_imports import gpu_only_import
  from functools import partial
  from cuml.common.sparsefuncs import create_csr_matrix_from_count_df
  from cuml.common.sparsefuncs import csr_row_normalize_l1, csr_row_normalize_l2
  from cuml.feature_extraction._stop_words import ENGLISH_STOP_WORDS
  from cuml.common.exceptions import NotFittedError
  from cuml.internals.safe_imports import gpu_only_import_from
label_desc: Use image node_id 7 for calling the HashingVectorizer obj's underlying member method code with example usage: obj.transform(raw_documents) and returns: X