Text Reader
Parameters and methods of TextReader, which reads text files into documents.
TextReader reads data from text files.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
chunking_strategy | Optional[ChunkingStrategy] | FixedSizeChunking() | Strategy used to chunk documents |
TextReader also accepts the base Reader constructor parameters.
Methods
read()
Reads a text file and returns a list of documents.
| Parameter | Type | Default | Description |
|---|---|---|---|
file | Union[Path, IO[Any]] | Required | A Path or a binary file-like object such as BytesIO; string paths and text-mode handles are not supported |
name | Optional[str] | None | Name override for the resulting documents |
async_read()
Async variant of read(). Accepts the same parameters.