Skip to content

Commit

Permalink
Fix FastText doc-comment example for build_vocab and train to use…
Browse files Browse the repository at this point in the history
… correct argument names (#3227)

* fix docs to match argument names

* dummy commit to trigger CI

* Update CHANGELOG.md

Co-authored-by: Michael Penkov <misha.penkov@gmail.com>
Co-authored-by: Michael Penkov <m@penkov.dev>
  • Loading branch information
3 people committed Oct 24, 2021
1 parent 64fcedf commit e5cb531
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changes
## Unreleased

* [#3194](https://github.com/RaRe-Technologies/gensim/pull/3194): Added random_seed parameter to make LsiModel reproducible, by [@parashardhapola](https://github.com/parashardhapola)
* [#3227](https://github.com/RaRe-Technologies/gensim/pull/3227): Fix FastText doc-comment example for `build_vocab` and `train` to use correct argument names, by [@HLasse](https://github.com/HLasse)

## 4.1.2, 2021-09-17

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,3 @@ BibTeX entry:
[OpenBLAS]: http://xianyi.github.io/OpenBLAS/
[source tar.gz]: http://pypi.python.org/pypi/gensim
[documentation]: http://radimrehurek.com/gensim/install.html

8 changes: 4 additions & 4 deletions gensim/models/fasttext.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
>>> print(len(common_texts))
9
>>> model = FastText(vector_size=4, window=3, min_count=1) # instantiate
>>> model.build_vocab(sentences=common_texts)
>>> model.train(sentences=common_texts, total_examples=len(common_texts), epochs=10) # train
>>> model.build_vocab(corpus_iterable=common_texts)
>>> model.train(corpus_iterable=common_texts, total_examples=len(common_texts), epochs=10) # train
Once you have a model, you can access its keyed vectors via the `model.wv` attributes.
The keyed vectors instance is quite powerful: it can perform a wide range of NLP tasks.
Expand Down Expand Up @@ -108,9 +108,9 @@
>>>
>>>
>>> model4 = FastText(vector_size=4, window=3, min_count=1)
>>> model4.build_vocab(sentences=MyIter())
>>> model4.build_vocab(corpus_iterable=MyIter())
>>> total_examples = model4.corpus_count
>>> model4.train(sentences=MyIter(), total_examples=total_examples, epochs=5)
>>> model4.train(corpus_iterable=MyIter(), total_examples=total_examples, epochs=5)
Persist a model to disk with:
Expand Down

0 comments on commit e5cb531

Please sign in to comment.