class gensim.models.NormModel(corpus=None, norm='l2')[source]

Objects of this class realize the explicit normalization of vectors. Supported norms are l1’ and ‘l2’ with ‘l2’ being default.

The main methods are:

  1. Constructor which normalizes the terms in the given corpus document-wise.
  2. The normalize() method which normalizes a simple count representation.
  3. The [] transformation which internally calls the self.normalize() method.
>>> norm_l2 = NormModel(corpus)
>>> print(norm_l2[some_doc])

Model persistency is achieved via its load/save methods


__init__([corpus, norm]) Compute the ‘l1’ or ‘l2’ normalization by normalizing separately for each doc in a corpus.
calc_norm(corpus) Calculates the norm by calling matutils.unitvec with the norm parameter.
load(fname[, mmap]) Load a previously saved object from file (also see save).
save(fname_or_handle[, separately, ...]) Save the object to file (also see load).