LoadAndSplit reads pdf data from the io.Reader and splits it into multiple documents using a text splitter.
(ctx context.Context, splitter textsplitter.TextSplitter)
| 104 | // LoadAndSplit reads pdf data from the io.Reader and splits it into multiple |
| 105 | // documents using a text splitter. |
| 106 | func (p PDF) LoadAndSplit(ctx context.Context, splitter textsplitter.TextSplitter) ([]schema.Document, error) { |
| 107 | docs, err := p.Load(ctx) |
| 108 | if err != nil { |
| 109 | return nil, err |
| 110 | } |
| 111 | |
| 112 | return textsplitter.SplitDocuments(splitter, docs) |
| 113 | } |