Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand the functionality of the DocumentCleaner #8798

Open
sjrl opened this issue Feb 3, 2025 · 0 comments
Open

Expand the functionality of the DocumentCleaner #8798

sjrl opened this issue Feb 3, 2025 · 0 comments
Labels
type:feature New feature or request

Comments

@sjrl
Copy link
Contributor

sjrl commented Feb 3, 2025

Is your feature request related to a problem? Please describe.
We've found in practice that cleaning up files before being used in RAG pipelines does increase overall performance. For example, this Haystack user found the same.

We do have a DocumentCleaner to help with this process, but we found there are some options missing for the type of cleaning we would like to accomplish.

Describe the solution you'd like
The options I'd like to add to the DocumentCleaner are:

  • an option that just runs .strip() on the content of every document. Often times we just want to remove the extra leading and trailing white space, but leave the white space within a chunk alone. For example, in mark down files the extra newlines can matter for formatting.
  • also an option to provide a regex pattern to remove and a string to replace that regex match with. We currently have a few regex replaces in the DocumentCleaner and have the remove_regex parameter, but we don't have a way to customize what string should be used to replace the regex match. For example, one scenario that I'd like to do is replace all double newline characters \n\n with a single newline character \n.

Describe alternatives you've considered
We can create a custom component do perform these operations instead.

@sjrl sjrl added the type:feature New feature or request label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant