Skip to content

[MRG] Updated docstrings for TfidfVectorizer functions - #15509

Merged
rth merged 10 commits into
scikit-learn:masterfrom
hailey0huong:master
Nov 15, 2019
Merged

rth merged 10 commits into
scikit-learn:masterfrom
hailey0huong:master

Conversation

@hailey0huong

@hailey0huong hailey0huong commented Nov 2, 2019 •

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Reference #15440

What does this implement/fix? Explain your changes.

Updated docstrings for TfidfVectorizer functions to pass numpydoc validation

Any other comments?

There are some methods left under this class got TypeError while running python maint_tools/test_docstrings.py that I don't know how to fix: idf_, norm, smooth_idf, sublinear_tf, use_idf

The error is below:
Traceback (most recent call last): File "maint_tools/test_docstrings.py", line 173, in <module> msg = repr_errors(res, method=args.import_path) File "maint_tools/test_docstrings.py", line 112, in repr_errors for code, message in res["errors"] TypeError: sequence item 0: expected str instance, NoneType found

@rth rth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @hailey0huong ! A few comments below.

Comment thread sklearn/feature_extraction/text.py Resolved
Comment thread sklearn/feature_extraction/text.py Resolved
Comment thread sklearn/feature_extraction/text.py Resolved
Comment thread sklearn/feature_extraction/text.py Outdated
Returns
-------
feature_names : list
A list of feature name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line should be indented only 4 spaces more than the one above

Comment thread sklearn/feature_extraction/text.py Resolved
Comment thread sklearn/feature_extraction/text.py Outdated
----------
raw_documents : iterable
an iterable which yields either str, unicode or file objects
An iterable which has either str, unicode or file objects.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please revert "has -> yields", as an iterable does yield objects.

Comment thread sklearn/feature_extraction/text.py Resolved
Comment thread sklearn/feature_extraction/text.py Resolved
Comment thread sklearn/feature_extraction/text.py Outdated
"""Return a callable that handles preprocessing, tokenization

"""
Return a callable that handles preprocessing, tokenization

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please revert the added line break.
It should be

"""Return ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just updated the format as your suggestions. Thanks!

@rth rth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

On last comment otherwise LGTM.

Comment thread sklearn/feature_extraction/text.py Resolved
@rth

rth commented Nov 15, 2019

Copy link
Copy Markdown
Member

Thanks, merging! The Codecov failure is not relevant (only docstrings changed in this PR).

@rth
rth merged commit 25a88b4 into scikit-learn:master Nov 15, 2019
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Nov 18, 2019
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Nov 18, 2019
panpiort8 pushed a commit to panpiort8/scikit-learn that referenced this pull request Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants