neomatrix369 / nlp_profiler

A simple NLP library allows profiling datasets with one or more text columns. When given a dataset and a column name containing text data, NLP Profiler will return either high-level insights or low-level/granular statistical information about the text in that column.
Other
243 stars 37 forks source link

Refactor: reformatting python code across all the source files (Sourcery refactored) #74

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

Pull Request #73 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will re-run and update (force-push) this Pull Request with new refactorings as necessary. If Sourcery finds no refactorings at any point, this Pull Request will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the reformating-code-and-minor-fixes branch, then run:

git fetch origin sourcery/reformating-code-and-minor-fixes
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 2.23%.

Quality metrics Before After Change
Complexity 1.25 ⭐ 1.25 ⭐ 0.00
Method Length 36.33 ⭐ 35.20 ⭐ -1.13 👍
Working memory 6.00 ⭐ 6.68 🙂 0.68 👎
Quality 84.72% 82.49% -2.23% 👎
Other metrics Before After Change
Lines 873 805 -68
Changed files Quality Before Quality After Quality Change
nlp_profiler/core.py 63.10% 🙂 66.99% 🙂 3.89% 👍
nlp_profiler/generate_features/__init__.py 71.82% 🙂 72.44% 🙂 0.62% 👍
nlp_profiler/generate_features/parallelisation_methods/__init__.py 90.29% ⭐ 91.42% ⭐ 1.13% 👍
nlp_profiler/granular_features/alphanumeric.py 97.09% ⭐ 94.76% ⭐ -2.33% 👎
nlp_profiler/granular_features/chars_spaces_and_whitespaces.py 94.66% ⭐ 91.52% ⭐ -3.14% 👎
nlp_profiler/granular_features/dates.py 90.18% ⭐ 88.11% ⭐ -2.07% 👎
nlp_profiler/granular_features/emojis.py 93.69% ⭐ 93.93% ⭐ 0.24% 👍
nlp_profiler/granular_features/english_non_english_chars.py 94.86% ⭐ 90.69% ⭐ -4.17% 👎
nlp_profiler/granular_features/letters.py 97.09% ⭐ 94.76% ⭐ -2.33% 👎
nlp_profiler/granular_features/non_alphanumeric.py 97.09% ⭐ 94.76% ⭐ -2.33% 👎
nlp_profiler/granular_features/noun_phrase_count.py 87.32% ⭐ 85.95% ⭐ -1.37% 👎
nlp_profiler/granular_features/numbers.py 97.09% ⭐ 94.76% ⭐ -2.33% 👎
nlp_profiler/granular_features/punctuations.py 90.93% ⭐ 88.44% ⭐ -2.49% 👎
nlp_profiler/granular_features/stop_words.py 93.13% ⭐ 93.52% ⭐ 0.39% 👍
nlp_profiler/granular_features/words.py 97.09% ⭐ 94.76% ⭐ -2.33% 👎
nlp_profiler/high_level_features/sentiment_polarity.py 86.78% ⭐ 87.66% ⭐ 0.88% 👍
nlp_profiler/high_level_features/sentiment_subjectivity.py 86.78% ⭐ 87.92% ⭐ 1.14% 👍
tests/common_functions.py 72.84% 🙂 71.98% 🙂 -0.86% 👎
tests/granular/test_english_non_english_characters.py 70.86% 🙂 70.81% 🙂 -0.05% 👎
tests/granular/test_punctuations.py 89.97% ⭐ 89.94% ⭐ -0.03% 👎
tests/granular/test_repeated_punctuations.py 70.60% 🙂 70.55% 🙂 -0.05% 👎
tests/granular/test_sentences.py 89.06% ⭐ 89.02% ⭐ -0.04% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
tests/common_functions.py internal_assert_benchmark 1 ⭐ 136 😞 13 😞 58.26% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/common_functions.py generate_data 0 ⭐ 80 🙂 16 ⛔ 62.86% 🙂 Extract out complex expressions
nlp_profiler/core.py apply_text_profiling 4 ⭐ 137 😞 7 🙂 66.99% 🙂 Try splitting into smaller methods
nlp_profiler/generate_features/__init__.py generate_features 2 ⭐ 63 🙂 10 😞 72.44% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!