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
241 stars 37 forks source link

Refactor: aggregating high-level features #34

Closed neomatrix369 closed 3 years ago

neomatrix369 commented 3 years ago

Refactor: aggregating high-level features into a separate module of it's own

Inspired by PR #29, related to #28, and partially resolves it (reduces complexity)

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 0.80 ⭐ 0.80 ⭐ 0.00
Method Length 49.20 ⭐ 49.20 ⭐ 0.00
Working memory 7.50 🙂 7.50 🙂 0.00
Quality 81.97% 81.97% 0.00%
Other metrics Before After Change
Lines 346 351 5
Changed files Quality Before Quality After Quality Change
nlp_profiler/core.py 71.16% 🙂 71.16% 🙂 0.00%
slow-tests/performance_tests/test_perf_grammar_check.py 85.30% ⭐ 85.30% ⭐ 0.00%
slow-tests/performance_tests/test_perf_spelling_check.py 85.30% ⭐ 85.30% ⭐ 0.00%
tests/high_level/test_grammar_check.py 87.02% ⭐ 87.02% ⭐ 0.00%
tests/high_level/test_sentiment_polarity.py 79.63% ⭐ 79.63% ⭐ 0.00%
tests/high_level/test_sentiment_subjectivity.py 79.63% ⭐ 79.63% ⭐ 0.00%
tests/high_level/test_spelling_check.py 75.75% ⭐ 75.75% ⭐ 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
nlp_profiler/core.py apply_text_profiling 4 ⭐ 133 😞 16 ⛔ 51.83% 🙂 Try splitting into smaller methods. Extract out complex expressions
slow-tests/performance_tests/test_perf_grammar_check.py test_given_a_text_column_when_profiler_is_applied_with_high_level_analysis_then_it_finishes_quick 2 ⭐ 122 😞 12 😞 60.51% 🙂 Try splitting into smaller methods. Extract out complex expressions
slow-tests/performance_tests/test_perf_spelling_check.py test_given_a_text_column_when_profiler_is_applied_with_high_level_analysis_then_it_finishes_quick 2 ⭐ 122 😞 12 😞 60.51% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/high_level/test_spelling_check.py test_given_a_text_when_spell_check_is_applied_then_spell_check_analysis_info_is_returned 2 ⭐ 68 🙂 11 😞 69.77% 🙂 Extract out complex expressions
tests/high_level/test_sentiment_polarity.py test_given_a_text_when_sentiment_analysis_is_applied_then_sentiment_analysis_info_is_returned 2 ⭐ 59 ⭐ 10 😞 73.06% 🙂 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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

neomatrix369 commented 3 years ago

Closing PR as PR #35 overrides this one and fixes a number of reported issues