split method

On this page

split

Splits the input string into individual words.

def split(self, text):
    ...
Parameter Type Description
text str The input text to be split.

Returns: Iterable[str]: An enumeration of words extracted from the input text.

Example

    class WhiteSpaceWordSplitter:
        def split(self, text):
            return text.split()

    splitter = WhiteSpaceWordSplitter()
    words = splitter.split("Hello world")
    print(list(words))  # ['Hello', 'world']
    ```

### Aliases

These names call `split` too, limited to the overloads listed.

| Alias | Accepts |
| :- | :- |
| `split_file` | `split_file(text)` |
| `split_string` | `split_string(text)` |

### See Also
* class [`IWordSplitter`](/search/python-net/groupdocs.search.common/iwordsplitter/)

On this page