Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Oct 16, 2020
1 parent 41cd9eb commit 738d3e8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions nlp_profiler/granular_features/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions nlp_profiler/granular_features/stop_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion nlp_profiler/sentiment_polarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down
2 changes: 1 addition & 1 deletion slow-tests/performance_tests/common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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

0 comments on commit 738d3e8

Please sign in to comment.