code: def test_split_by_word(self):
      splitter = DocumentSplitter(split_by="word", split_length=10)
      result = splitter.run(
          documents=[
              Document(
                  content="This is a text with some words. There is a second sentence. And there is a third sentence."
              )
          ]
      )
      assert len(result["documents"]) == 2
      assert (
          result["documents"][0].content
          == "This is a text with some words. There is a "
      )
      assert (
          result["documents"][1].content
          == "second sentence. And there is a third sentence."
      )
  
file_path: haystack/test/components/preprocessors/test_document_splitter.py
imports: import pytest
  from haystack import Document
  from haystack.components.preprocessors import DocumentSplitter
label_desc: Use image node_id 7 for calling the TestDocumentSplitter obj's underlying member method code with example usage: obj.test_split_by_word() without return types