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

Add __getitem__ method to Sparse2Corpus to allow direct queries #1621

Merged
merged 3 commits into from
Oct 13, 2017

Conversation

isamaru
Copy link
Contributor

@isamaru isamaru commented Oct 10, 2017

@piskvorky @janpom @menshikh-iv

Adds __getitem__ method to Sparse2Corpus to enable direct doc querying.
Was necessary so that the CSC corpus could be used for similarity computation, and looks overall useful.

@@ -342,6 +342,11 @@ def __iter__(self):
def __len__(self):
return self.sparse.shape[1]

def __getitem__(self, item):
Copy link
Owner

@piskvorky piskvorky Oct 10, 2017

Choose a reason for hiding this comment

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

What is item? Row index, column index, something else?

Missing docstring (method semantics, args, returns).

Copy link
Contributor

@menshikh-iv menshikh-iv left a comment

Choose a reason for hiding this comment

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

Docstring in Numpy style please, guide - https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt

P/S Don't forget to pull your branch first, because I fixed PEP8 mistake in your code

@menshikh-iv
Copy link
Contributor

Thank you @isamaru, congratz with first PR 👍

@menshikh-iv menshikh-iv merged commit 44b0403 into piskvorky:develop Oct 13, 2017
horpto pushed a commit to horpto/gensim that referenced this pull request Oct 28, 2017
…vorky#1621)

* Add __getitem__ method to Sparse2Corpus to allow direct queries

* Fix PEP8

* Add docstring for Sparse2Corpus.__getitem__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants