preprocess_texts
Preprocess texts: optionally split to sentences, filter.
If config is None or split_to_sentences is False, returns texts as-is (with optional length/char filtering).
When split_to_sentences is True or an integer:
- If spacy_model is given: use spacy sentencizer.
- Otherwise: use simple regex split on .!?
- Integer values greater than 1 yield non-overlapping sentence windows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
texts
|
List[str]
|
Input text strings (paragraphs or documents). |
required |
config
|
Optional[TextPreprocessConfig]
|
TextPreprocessConfig. If None, returns texts as-is. |
None
|
spacy_model
|
Optional[str]
|
Spacy model name for sentencizer (e.g. "de_core_news_sm"). Only used when split_to_sentences is truthy. |
None
|
download_if_missing
|
bool
|
If True, download the spacy model if it is not found. |
True
|
Returns:
| Type | Description |
|---|---|
List[str]
|
List of (optionally filtered) text strings. |