/ haystack / testing / sample_components / text_splitter.py
text_splitter.py
 1  # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
 2  #
 3  # SPDX-License-Identifier: Apache-2.0
 4  
 5  
 6  from haystack.core.component import component
 7  
 8  
 9  @component
10  class TextSplitter:
11      @component.output_types(output=list[str])
12      def run(self, sentence: str):
13          """Takes a sentence in input and returns its words in output."""
14          return {"output": sentence.split()}