Skip to content

Commit

Permalink
reduce bm25 memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelsty committed Jun 2, 2024
1 parent e99e0ac commit b36f8ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "lenlp"
version = "1.1.0"
version = "1.1.1"
description = "Natural Language Processing library for Python from Rust."

authors = [
Expand Down
2 changes: 1 addition & 1 deletion python/lenlp/sparse/bm25_vectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _transform(self, matrix: csr_matrix) -> csr_matrix:
)
)

denominator = matrix.copy().tocsc()
denominator = matrix.tocsc()
denominator.data += np.take(a=regularization, indices=denominator.indices)
matrix.data = (
(matrix.data * (self.k1 + 1)) / denominator.tocsr().data
Expand Down

0 comments on commit b36f8ae

Please sign in to comment.