gensim logo

gensim tagline

Get Expert Help

• machine learning, NLP, data mining

• custom SW design, development, optimizations

• corporate trainings & IT consulting

sklearn_api.phrases – Scikit learn wrapper for phrase (collocation) detection

sklearn_api.phrases – Scikit learn wrapper for phrase (collocation) detection

Scikit learn interface for gensim for easy use of gensim with scikit-learn Follows scikit-learn API conventions

class gensim.sklearn_api.phrases.PhrasesTransformer(min_count=5, threshold=10.0, max_vocab_size=40000000, delimiter='_', progress_per=10000, scoring='default')

Bases: sklearn.base.TransformerMixin, sklearn.base.BaseEstimator

Base Phrases module

Sklearn wrapper for Phrases model.

fit(X, y=None)

Fit the model according to the given training data.

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

  • X (numpy array of shape [n_samples, n_features]) – Training set.
  • y (numpy array of shape [n_samples]) – Target values.

X_new – Transformed array.

Return type:

numpy array of shape [n_samples, n_features_new]


Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Return type:self

Return the input documents to return phrase tokens.