Dedoc
in combination with LangChain
as a DocumentLoader
.
Dedoc
supports DOCX
, XLSX
, PPTX
, EML
, HTML
, PDF
, images and more.
Full list of supported formats can be found here.
Class | Package | Local | Serializable | JS support |
---|---|---|---|---|
DedocFileLoader | langchain_community | ❌ | beta | ❌ |
DedocPDFLoader | langchain_community | ❌ | beta | ❌ |
DedocAPIFileLoader | langchain_community | ❌ | beta | ❌ |
Source | Document Lazy Loading | Async Support |
---|---|---|
DedocFileLoader | ❌ | ❌ |
DedocPDFLoader | ❌ | ❌ |
DedocAPIFileLoader | ❌ | ❌ |
DedocFileLoader
and DedocPDFLoader
document loaders, you’ll need to install the dedoc
integration package.DedocAPIFileLoader
, you’ll need to run the Dedoc
service, e.g. Docker
container (please see the documentation
for more details):Dedoc
installation instruction is given here.
Dedoc
loaders, please see the API references:
DedocFileLoader
can be useful.
The file loader automatically detects the file type with a correct extension.
File parsing process can be configured through dedoc_kwargs
during the DedocFileLoader
class initialization.
Here the basic examples of some options usage are given,
please see the documentation of DedocFileLoader
and
dedoc documentation
to get more details about configuration parameters.
DedocFileLoader
supports different types of document splitting into parts (each part is returned separately).
For this purpose, split
parameter is used with the following options:
document
(default value): document text is returned as a single langchain Document
object (don’t split);page
: split document text into pages (works for PDF
, DJVU
, PPTX
, PPT
, ODP
);node
: split document text into Dedoc
tree nodes (title nodes, list item nodes, raw text nodes);line
: split document text into textual lines.DedocFileLoader
supports tables handling when with_tables
parameter is
set to True
during loader initialization (with_tables=True
by default).
Tables are not split - each table corresponds to one langchain Document
object.
For tables, Document
object has additional metadata
fields type="table"
and text_as_html
with table HTML
representation.
DedocFileLoader
supports attached files handling when with_attachments
is set
to True
during loader initialization (with_attachments=False
by default).
Attachments are split according to the split
parameter.
For attachments, langchain Document
object has an additional metadata
field type="attachment"
.
PDF
documents, you can use DedocPDFLoader
with only PDF
support.
The loader supports the same parameters for document split, tables and attachments extraction.
Dedoc
can extract PDF
with or without a textual layer,
as well as automatically detect its presence and correctness.
Several PDF
handlers are available, you can use pdf_with_text_layer
parameter to choose one of them.
Please see parameters description
to get more details.
For PDF
without a textual layer, Tesseract OCR
and its language packages should be installed.
In this case, the instruction can be useful.
Dedoc
as a service.
DedocAPIFileLoader
can be used without installation of dedoc
library.
The loader supports the same parameters as DedocFileLoader
and
also automatically detects input file types.
To use DedocAPIFileLoader
, you should run the Dedoc
service, e.g. Docker
container (please see the documentation
for more details):
https://dedoc-readme.hf.space
in your code.