Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docstrings for gensim.models.rpmodel #1802

Merged
merged 14 commits into from
Dec 27, 2017
14 changes: 13 additions & 1 deletion gensim/models/rpmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
Objects of this class allow building and maintaining a model for Random Projections
(also known as Random Indexing).

For theoretical background on RP, see: Kanerva et al.: "Random indexing of text samples for Latent Semantic Analysis."
For theoretical background on RP, see [1]_.
: Kanerva et al.: "Random indexing of text samples for Latent Semantic Analysis."

The main methods are:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add example here (sometimes code tell us more than text)


Expand All @@ -31,6 +32,10 @@
>>> some_doc = dictionary.doc2bow(common_texts[0])
>>> print(rp[some_doc])
>>> rp.save('/tmp/foo.rp_model')


.. [1] Kanerva et al., 2000, Random indexing of text samples for Latent Semantic Analysis, https://cloudfront.escholarship.org/dist/prd/content/qt5644k0w6/qt5644k0w6.pdf

"""

import logging
Expand All @@ -55,8 +60,13 @@ def __init__(self, corpus, id2word=None, num_topics=300):
Parameters
----------
corpus : :class:`~gensim.interfaces.CorpusABC`
Iterable of documents

id2word : dict of (int, string)
Mapping from word ids (integers) to words (strings)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant type definition


num_topics : int
Number of topics

"""
self.id2word = id2word
Expand All @@ -75,6 +85,7 @@ def initialize(self, corpus):
Parameters
----------
corpus : :class:`~interfaces.CorpusABC`
Iterable of documents

"""
if self.id2word is None:
Expand Down Expand Up @@ -103,6 +114,7 @@ def __getitem__(self, bow):
Parameters
----------
bow : :class:`~interfaces.CorpusABC` (iterable of documents) or list of (int, int).
Input document

Examples:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant :

-------------
Expand Down