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

Wrong parameter information in gensim.models.keyedvectors.KeyedVectors.save() docstring. #3528

Open
Stfort52 opened this issue Apr 20, 2024 · 0 comments

Comments

@Stfort52
Copy link

Stfort52 commented Apr 20, 2024

Problem description

Wrong parameter docstrings are in gensim.models.keyedvectors.KeyedVectors.save().

Steps/code/corpus to reproduce

Its docstrings say it has fname as its first parameter,

def save(self, *args, **kwargs):
"""Save KeyedVectors to a file.
Parameters
----------
fname : str
Path to the output file.

but gensim.utils.SaveLoad.save()'s fname parameter was changed into fname_or_handle about 9 years ago(fcf12fa), which can be puzzling.

gensim/gensim/utils.py

Lines 724 to 734 in 645c2d1

def save(
self, fname_or_handle,
separately=None, sep_limit=10 * 1024**2, ignore=frozenset(), pickle_protocol=PICKLE_PROTOCOL,
):
"""Save the object to a file.
Parameters
----------
fname_or_handle : str or file-like
Path to output file or already opened file-like object. If the object is a file handle,
no special array handling will be performed, all attributes will be saved to the same file.

Could open a PR for this, but some docstrings like gensim.models.poincare.PoincareModel.save() has a different flavor, so I couldn't decide which one should I follow.

def save(self, *args, **kwargs):
"""Save complete model to disk, inherited from :class:`~gensim.utils.SaveLoad`.
See also
--------
:meth:`~gensim.models.poincare.PoincareModel.load`
Parameters
----------
*args
Positional arguments passed to :meth:`~gensim.utils.SaveLoad.save`.

Could be a nice idea to clean things up, I guess.

Versions

Pretty sure it's not going to matter, but here it is.

Linux-3.10.0-1160.el7.x86_64-x86_64-with-glibc2.17
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
Bits 64
NumPy 1.26.4
SciPy 1.12.0
gensim 4.3.2
FAST_VERSION 1
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

No branches or pull requests

1 participant