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 high level features #37

Closed neomatrix369 closed 4 years ago

neomatrix369 commented 4 years ago

Redoing the PR as something went wrong in the previous attempt

Now the high-level modules are placed inside the high_level_features folder

Related to #35 (and #34)

sourcery-ai[bot] commented 4 years ago

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 1.00 ⭐ 1.00 ⭐ 0.00
Method Length 58.00 ⭐ 58.00 ⭐ 0.00
Working memory 8.86 πŸ™‚ 8.86 πŸ™‚ 0.00
Quality 77.64% ⭐ 77.64% ⭐ 0.00%
Other metrics Before After Change
Lines 300 304 4
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 75.16% ⭐ 75.16% ⭐ 0.00%
slow-tests/performance_tests/test_perf_spelling_check.py 75.16% ⭐ 75.16% ⭐ 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 ⭐ 113 πŸ™‚ 13 😞 60.07% πŸ™‚ 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 ⭐ 113 πŸ™‚ 13 😞 60.07% πŸ™‚ 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.

codecov[bot] commented 4 years ago

Codecov Report

Merging #37 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #37   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines          358       358           
  Branches        51        51           
=========================================
  Hits           358       358           
Impacted Files Coverage Ξ”
...filer/high_level_features/grammar_quality_check.py 100.00% <ΓΈ> (ΓΈ)
...profiler/high_level_features/sentiment_polarity.py 100.00% <ΓΈ> (ΓΈ)
...iler/high_level_features/sentiment_subjectivity.py 100.00% <ΓΈ> (ΓΈ)
...iler/high_level_features/spelling_quality_check.py 100.00% <ΓΈ> (ΓΈ)
nlp_profiler/core.py 100.00% <100.00%> (ΓΈ)
nlp_profiler/high_level_features/__init__.py 100.00% <100.00%> (ΓΈ)

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 3aac701...99249e2. Read the comment docs.