gensim logo

gensim
gensim tagline

Get Expert Help From The Gensim Authors

Consulting in Machine Learning & NLP

• Commercial document similarity engine: ScaleText.ai

Corporate trainings in Python Data Science and Deep Learning

models._utils_any2vec – Cython utils for any2vec models

models._utils_any2vec – Cython utils for any2vec models

General functions used for any2vec models.

gensim.models._utils_any2vec.compute_ngrams(word, unsigned int min_n, unsigned int max_n)

Get the list of all possible ngrams for a given word.

Parameters:
  • word (str) – The word whose ngrams need to be computed.
  • min_n (unsigned int) – Minimum character length of the ngrams.
  • max_n (unsigned int) – Maximum character length of the ngrams.
Returns:

Sequence of character ngrams.

Return type:

list of str

gensim.models._utils_any2vec.ft_hash(unicode string)

Calculate hash based on string. Reproduce hash method from Facebook fastText implementation.

Parameters:string (unicode) – The string whose hash needs to be calculated.
Returns:The hash of the string.
Return type:unsigned int