Skip to content

Commit

Permalink
docs: add deprecation warning nltk document splitter (#8628)
Browse files Browse the repository at this point in the history
* adding deprecation warning

* adding release notes

* adding release notes

* updating message

* Update haystack/components/preprocessors/nltk_document_splitter.py

Co-authored-by: Daria Fokina <[email protected]>

---------

Co-authored-by: Daria Fokina <[email protected]>
  • Loading branch information
davidsbatista and dfokina authored Dec 12, 2024
1 parent 04fc187 commit 6cceaac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions haystack/components/preprocessors/nltk_document_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0

import warnings
from copy import deepcopy
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple

Expand Down Expand Up @@ -52,6 +53,13 @@ def __init__( # pylint: disable=too-many-positional-arguments
representing the chunks after splitting.
"""

warnings.warn(
"The NLTKDocumentSplitter is deprecated and will be removed in the next release. "
"See DocumentSplitter which now supports the functionalities of the NLTKDocumentSplitter, i.e.: "
"using NLTK to detect sentence boundaries.",
DeprecationWarning,
)

super(NLTKDocumentSplitter, self).__init__(
split_by=split_by,
split_length=split_length,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
deprecations:
- |
The NLTKDocumentSplitter will deprecated and will be removed in the next release. The DocumentSplitter will instead support the functionality of the NLTKDocumentSplitter.

0 comments on commit 6cceaac

Please sign in to comment.