-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Let process_text() return a dict. #120
Conversation
You could just call I agree, returning a dict might have been nicer. When I wrote this, I was using python2, where this actually returns a tuple, as it is documented. You also changed the input type for |
Thanks, @amueller .
Oh, right! I didn't think about it. It's only frustrating conceptually, but not technically, I agree.
I'm happy to update it... But it's not very clear to me whether the module runs Python 3 or both Python 2 and 3. In a way, it's cool that it works with both (if I understand correctly), but it's worth mentioning explicitly (typically, in the README). I tend to push for porting to Python 3 and moving on to using Python 3 in general.
No, I have not changed the input type for |
You're right, I misread the code. It thought it would be more natural if the output of one function would be the input of the next. I guess it would be possible to accept dicts or The codebase is Python2 and Python3 compatible. I would not like to drop Python2.7 any time soon. The CI tests 2.7 and 3.4 at the moment. Feel free to add to the readme. Also feel free to add tests for just calling It is still a backward incompatible change, since the return type of What I'd like for this to be merged is:
It would be nice to have |
479d8f1
to
b006ff0
Compare
Hi @amueller ! Sorry for the delay on this. I have thus rebased the branch onto I'm not sure where I can add the |
@@ -376,7 +376,7 @@ def process_text(self, text): | |||
|
|||
Returns | |||
------- | |||
words : list of tuples (string, float) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add
..versionchanged:: 1.2.2
Changed return type from list of tuples to dict
to the docstring and similarly for generate_from_text
.
@amueller Done! Thank you. |
cool, thanks :) |
Hi @amueller !
While playing around, I found myself frustrated with
process_text()
returning a object of class 'dict_items'... Indeed, what if I want to apply further processing, or edit manually my dictionary of words, before turning it into an actual word cloud? I believe I should have the flexibility to do so. Generally speaking, it seems preferable to use standard data structures for input and output values.Thank you for your consideration.