gensim/corpora/textcorpus.py
Killed 5 out of 18 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 4
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -47,7 +47,7 @@
from gensim.parsing.preprocessing import STOPWORDS, RE_WHITESPACE
from gensim.utils import deaccent, simple_tokenize
-logger = logging.getLogger(__name__)
+logger = None
def remove_stopwords(tokens, stopwords=STOPWORDS):
Mutant 5
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -69,7 +69,7 @@
return [token for token in tokens if token not in stopwords]
-def remove_short(tokens, minsize=3):
+def remove_short(tokens, minsize=4):
"""Remove tokens shorter than `minsize` chars.
Parameters
Mutant 6
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -88,7 +88,7 @@
return [token for token in tokens if len(token) >= minsize]
-def lower_to_unicode(text, encoding='utf8', errors='strict'):
+def lower_to_unicode(text, encoding='XXutf8XX', errors='strict'):
"""Lowercase `text` and convert to unicode, using :func:`gensim.utils.any2unicode`.
Parameters
Mutant 7
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -88,7 +88,7 @@
return [token for token in tokens if len(token) >= minsize]
-def lower_to_unicode(text, encoding='utf8', errors='strict'):
+def lower_to_unicode(text, encoding='utf8', errors='XXstrictXX'):
"""Lowercase `text` and convert to unicode, using :func:`gensim.utils.any2unicode`.
Parameters
Mutant 8
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -477,7 +477,7 @@
"""
def __init__(self, input, dictionary=None, metadata=False, min_depth=0, max_depth=None,
- pattern=None, exclude_pattern=None, lines_are_documents=False, **kwargs):
+ pattern=None, exclude_pattern=None, lines_are_documents=True, **kwargs):
"""
Parameters
Mutant 10
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -516,7 +516,6 @@
def lines_are_documents(self):
return self._lines_are_documents
- @lines_are_documents.setter
def lines_are_documents(self, lines_are_documents):
self._lines_are_documents = lines_are_documents
self.length = None
Mutant 12
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -525,7 +525,6 @@
def pattern(self):
return self._pattern
- @pattern.setter
def pattern(self, pattern):
self._pattern = None if pattern is None else re.compile(pattern)
self.length = None
Mutant 14
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -534,7 +534,6 @@
def exclude_pattern(self):
return self._exclude_pattern
- @exclude_pattern.setter
def exclude_pattern(self, pattern):
self._exclude_pattern = None if pattern is None else re.compile(pattern)
self.length = None
Mutant 16
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -543,7 +543,6 @@
def min_depth(self):
return self._min_depth
- @min_depth.setter
def min_depth(self, min_depth):
self._min_depth = min_depth
self.length = None
Mutant 18
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -552,7 +552,6 @@
def max_depth(self):
return self._max_depth
- @max_depth.setter
def max_depth(self, max_depth):
self._max_depth = max_depth
self.length = None
Mutant 19
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -620,7 +620,7 @@
self.length = sum(1 for _ in self.getstream())
-def walk(top, topdown=True, onerror=None, followlinks=False, depth=0):
+def walk(top, topdown=False, onerror=None, followlinks=False, depth=0):
"""Generate the file names in a directory tree by walking the tree either top-down or bottom-up.
For each directory in the tree rooted at directory top (including top itself), it yields a 4-tuple
(depth, dirpath, dirnames, filenames).
Mutant 20
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -620,7 +620,7 @@
self.length = sum(1 for _ in self.getstream())
-def walk(top, topdown=True, onerror=None, followlinks=False, depth=0):
+def walk(top, topdown=True, onerror=None, followlinks=True, depth=0):
"""Generate the file names in a directory tree by walking the tree either top-down or bottom-up.
For each directory in the tree rooted at directory top (including top itself), it yields a 4-tuple
(depth, dirpath, dirnames, filenames).
Mutant 21
--- gensim/corpora/textcorpus.py
+++ gensim/corpora/textcorpus.py
@@ -620,7 +620,7 @@
self.length = sum(1 for _ in self.getstream())
-def walk(top, topdown=True, onerror=None, followlinks=False, depth=0):
+def walk(top, topdown=True, onerror=None, followlinks=False, depth=1):
"""Generate the file names in a directory tree by walking the tree either top-down or bottom-up.
For each directory in the tree rooted at directory top (including top itself), it yields a 4-tuple
(depth, dirpath, dirnames, filenames).