Repository: piskvorky/gensim

Issue:
WikiCorpus.get_text logs ARTICLE_MIN_WORDS instead of article_min_tokens
<!--
**IMPORTANT**:

- Use the [Gensim mailing list](https://groups.google.com/forum/#!forum/gensim) to ask general or usage questions. Github issues are only for bug reports.
- Check [Recipes&FAQ](https://github.com/RaRe-Technologies/gensim/wiki/Recipes-&-FAQ) first for common answers.

Github bug reports that do not include relevant information and context will be closed without an answer. Thanks!
-->

#### Problem description

`WikiCorpus.get_texts` logs `ARTICLE_MIN_WORDS` instead of `article_min_tokens`.
I've passed a custom value for `article_min_tokens` but instead default one gets logged.
See:
https://github.com/RaRe-Technologies/gensim/blob/3.8.0/gensim/corpora/wikicorpus.py#L703
https://github.com/RaRe-Technologies/gensim/blob/3.8.0/gensim/corpora/wikicorpus.py#L712

#### Steps/code/corpus to reproduce

1. Just provide any value for `article_min_tokens` (except 50 obviously) in `WikiCorpus.__init__`
2. Invoke `get_texts`
2. See default one in logs

#### Versions

Please provide the output of:

```python
Python 3.7.3 (default, May  8 2019, 05:28:42)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; print(platform.platform())
Linux-4.9.125-linuxkit-x86_64-with-debian-9.9
>>> import sys; print("Python", sys.version)
Python 3.7.3 (default, May  8 2019, 05:28:42)
[GCC 6.3.0 20170516]
>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.16.4
>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.3.0
>>> import gensim; print("gensim", gensim.__version__)
gensim 3.7.3
>>> from gensim.models import word2vec;print("FAST_VERSION", word2vec.FAST_VERSION)
FAST_VERSION 1
```

WikiCorpus.get_text logs ARTICLE_MIN_WORDS instead of article_min_tokens
<!--
**IMPORTANT**:

- Use the [Gensim mailing list](https://groups.google.com/forum/#!forum/gensim) to ask general or usage questions. Github issues are only for bug reports.
- Check [Recipes&FAQ](https://github.com/RaRe-Technologies/gensim/wiki/Recipes-&-FAQ) first for common answers.

Github bug reports that do not include relevant information and context will be closed without an answer. Thanks!
-->

#### Problem description

`WikiCorpus.get_texts` logs `ARTICLE_MIN_WORDS` instead of `article_min_tokens`.
I've passed a custom value for `article_min_tokens` but instead default one gets logged.
See:
https://github.com/RaRe-Technologies/gensim/blob/3.8.0/gensim/corpora/wikicorpus.py#L703
https://github.com/RaRe-Technologies/gensim/blob/3.8.0/gensim/corpora/wikicorpus.py#L712

#### Steps/code/corpus to reproduce

1. Just provide any value for `article_min_tokens` (except 50 obviously) in `WikiCorpus.__init__`
2. Invoke `get_texts`
2. See default one in logs

#### Versions

Please provide the output of:

```python
Python 3.7.3 (default, May  8 2019, 05:28:42)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; print(platform.platform())
Linux-4.9.125-linuxkit-x86_64-with-debian-9.9
>>> import sys; print("Python", sys.version)
Python 3.7.3 (default, May  8 2019, 05:28:42)
[GCC 6.3.0 20170516]
>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.16.4
>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.3.0
>>> import gensim; print("gensim", gensim.__version__)
gensim 3.7.3
>>> from gensim.models import word2vec;print("FAST_VERSION", word2vec.FAST_VERSION)
FAST_VERSION 1
```



Discussion:
Thank you for reporting this. Are you able to make a PR?
Thank you for reporting this. Are you able to make a PR?

Resolving patch:
diff --git a/gensim/corpora/wikicorpus.py b/gensim/corpora/wikicorpus.py
--- a/gensim/corpora/wikicorpus.py
+++ b/gensim/corpora/wikicorpus.py
@@ -700,7 +700,7 @@ def get_texts(self):
             logger.warn(
                 "user terminated iteration over Wikipedia corpus after %i documents with %i positions "
                 "(total %i articles, %i positions before pruning articles shorter than %i words)",
-                articles, positions, articles_all, positions_all, ARTICLE_MIN_WORDS
+                articles, positions, articles_all, positions_all, self.article_min_tokens
             )
         except PicklingError as exc:
             raise_from(PicklingError('Can not send filtering function {} to multiprocessing, '
@@ -709,7 +709,7 @@ def get_texts(self):
             logger.info(
                 "finished iterating over Wikipedia corpus of %i documents with %i positions "
                 "(total %i articles, %i positions before pruning articles shorter than %i words)",
-                articles, positions, articles_all, positions_all, ARTICLE_MIN_WORDS
+                articles, positions, articles_all, positions_all, self.article_min_tokens
             )
             self.length = articles  # cache corpus length
         finally:


Test patch: