adbar / py3langid

Faster, modernized fork of the language identification tool langid.py
https://adrien.barbaresi.eu/blog/language-detection-langid-py-faster.html
Other
48 stars 8 forks source link

Sourcery refactored master branch #8

Closed sourcery-ai[bot] closed 2 years ago

sourcery-ai[bot] commented 2 years ago

Branch master refactored by Sourcery.

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

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 master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.76%.

Quality metrics Before After Change
Complexity 9.59 🙂 8.74 🙂 -0.85 👍
Method Length 90.77 🙂 89.61 🙂 -1.16 👍
Working memory 9.66 🙂 9.68 🙂 0.02 👎
Quality 54.70% 🙂 55.46% 🙂 0.76% 👍
Other metrics Before After Change
Lines 1961 1944 -17
Changed files Quality Before Quality After Quality Change
setup.py 94.23% ⭐ 94.38% ⭐ 0.15% 👍
py3langid/examples/_twokenize.py 55.17% 🙂 54.79% 🙂 -0.38% 👎
py3langid/tools/printfeats.py 94.18% ⭐ 95.34% ⭐ 1.16% 👍
py3langid/train/DFfeatureselect.py 52.88% 🙂 54.27% 🙂 1.39% 👍
py3langid/train/IGweight.py 44.61% 😞 46.48% 😞 1.87% 👍
py3langid/train/LDfeatureselect.py 53.86% 🙂 54.50% 🙂 0.64% 👍
py3langid/train/NBtrain.py 59.63% 🙂 61.82% 🙂 2.19% 👍
py3langid/train/common.py 82.11% ⭐ 83.02% ⭐ 0.91% 👍
py3langid/train/index.py 56.40% 🙂 57.03% 🙂 0.63% 👍
py3langid/train/scanner.py 43.95% 😞 43.01% 😞 -0.94% 👎
py3langid/train/tokenize.py 48.42% 😞 49.66% 😞 1.24% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
py3langid/train/scanner.py Scanner.build 44 ⛔ 386 ⛔ 8.94% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
py3langid/train/tokenize.py pass_tokenize 20 😞 276 ⛔ 14 😞 29.58% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
py3langid/train/IGweight.py pass_IG 17 🙂 345 ⛔ 13 😞 31.13% 😞 Try splitting into smaller methods. Extract out complex expressions
py3langid/train/NBtrain.py learn_ptc 3 ⭐ 283 ⛔ 15 😞 42.95% 😞 Try splitting into smaller methods. Extract out complex expressions
py3langid/train/tokenize.py build_index 4 ⭐ 183 😞 14 😞 49.18% 😞 Try splitting into smaller methods. 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!