diff --git a/nlp_profiler/numbers.py b/nlp_profiler/numbers.py index 9aac768..db56e4c 100644 --- a/nlp_profiler/numbers.py +++ b/nlp_profiler/numbers.py @@ -8,8 +8,7 @@ def gather_whole_numbers(text: str) -> list: if not isinstance(text, str): return [] - line = re.findall(r'[0-9]+', text) - return line + return re.findall(r'[0-9]+', text) def count_whole_numbers(text: str) -> int: diff --git a/nlp_profiler/sentiment_polarity.py b/nlp_profiler/sentiment_polarity.py index 5b2e1e9..08941df 100644 --- a/nlp_profiler/sentiment_polarity.py +++ b/nlp_profiler/sentiment_polarity.py @@ -38,7 +38,7 @@ def sentiment_polarity(score: float) -> str: score = float(score) score = (score + 1) / 2 # see https://stats.stackexchange.com/questions/70801/how-to-normalize-data-to-0-1-range - score = score * 100 + score *= 100 for _, each_slab in enumerate(sentiment_polarity_to_words_mapping): # pragma: no cover # pragma: no cover => early termination leads to loss of test coverage info if (score >= each_slab[1]) and (score <= each_slab[2]): diff --git a/nlp_profiler/stop_words.py b/nlp_profiler/stop_words.py index 9b3bbbc..4d48a59 100644 --- a/nlp_profiler/stop_words.py +++ b/nlp_profiler/stop_words.py @@ -15,9 +15,8 @@ def gather_stop_words(text: str) -> list: return [] word_tokens = word_tokenize(text) - found_stop_words = [word for _, word in enumerate(word_tokens) + return [word for _, word in enumerate(word_tokens) if word in STOP_WORDS] - return found_stop_words def count_stop_words(text: str) -> int: diff --git a/slow-tests/performance_tests/test_perf_grammar_check.py b/slow-tests/performance_tests/test_perf_grammar_check.py index eaec0a9..4adf974 100644 --- a/slow-tests/performance_tests/test_perf_grammar_check.py +++ b/slow-tests/performance_tests/test_perf_grammar_check.py @@ -68,6 +68,6 @@ def generate_data() -> list: text_with_punctuations, text_with_a_date, text_with_dates, text_with_duplicates] new_data = [] - for index in range(1): + for _ in range(1): new_data.extend(data) return new_data diff --git a/slow-tests/performance_tests/test_perf_spelling_check.py b/slow-tests/performance_tests/test_perf_spelling_check.py index e44809c..9dcfc08 100644 --- a/slow-tests/performance_tests/test_perf_spelling_check.py +++ b/slow-tests/performance_tests/test_perf_spelling_check.py @@ -68,6 +68,6 @@ def generate_data() -> list: text_with_punctuations, text_with_a_date, text_with_dates, text_with_duplicates] new_data = [] - for index in range(1): + for _ in range(1): new_data.extend(data) return new_data