mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 10:31:29 +08:00
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038) * refactor: Fix naming conventions (#7038) * Update arithmetic_analysis/lu_decomposition.py Co-authored-by: Christian Clauss <cclauss@me.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038) * chore: Fix naming conventions in doctests (#7038) * fix: Temporarily disable project euler problem 104 (#7069) * chore: Fix naming conventions in doctests (#7038) Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -83,7 +83,7 @@ the third document in the corpus.")
|
||||
return (len([doc for doc in docs if term in doc]), len(docs))
|
||||
|
||||
|
||||
def inverse_document_frequency(df: int, N: int, smoothing=False) -> float:
|
||||
def inverse_document_frequency(df: int, n: int, smoothing=False) -> float:
|
||||
"""
|
||||
Return an integer denoting the importance
|
||||
of a word. This measure of importance is
|
||||
@ -109,15 +109,15 @@ def inverse_document_frequency(df: int, N: int, smoothing=False) -> float:
|
||||
1.477
|
||||
"""
|
||||
if smoothing:
|
||||
if N == 0:
|
||||
if n == 0:
|
||||
raise ValueError("log10(0) is undefined.")
|
||||
return round(1 + log10(N / (1 + df)), 3)
|
||||
return round(1 + log10(n / (1 + df)), 3)
|
||||
|
||||
if df == 0:
|
||||
raise ZeroDivisionError("df must be > 0")
|
||||
elif N == 0:
|
||||
elif n == 0:
|
||||
raise ValueError("log10(0) is undefined.")
|
||||
return round(log10(N / df), 3)
|
||||
return round(log10(n / df), 3)
|
||||
|
||||
|
||||
def tf_idf(tf: int, idf: int) -> float:
|
||||
|
Reference in New Issue
Block a user