Releases: Unstructured-IO/unstructured
Releases · Unstructured-IO/unstructured
0.11.5
0.11.4
0.11.4
Enhancements
- Refactor image extraction code. The image extraction code is moved from
unstructured-inference
tounstructured
. - Refactor pdfminer code. The pdfminer code is moved from
unstructured-inference
tounstructured
. - Improve handling of auth data for fsspec connectors. Leverage an extension of the dataclass paradigm to support a
sensitive
annotation for fields related to auth (i.e. passwords, tokens). Refactor all fsspec connectors to use explicit access configs rather than a generic dictionary. - Add glob support for fsspec connectors Similar to the glob support in the ingest local source connector, similar filters are now enabled on all fsspec based source connectors to limit files being partitioned.
- Define a constant for the splitter "+" used in tesseract ocr languages.
Features
- Save tables in PDF's separately as images. The "table" elements are saved as
table-<pageN>-<tableN>.jpg
. This filename is presented in theimage_path
metadata field for the Table element. The default would be to not do this. - Add Weaviate destination connector Weaviate connector added to ingest CLI. Users may now use
unstructured-ingest
to write partitioned data from over 20 data sources (so far) to a Weaviate object collection. - Sftp Source Connector. New source connector added to support downloading/partitioning files from Sftp.
Fixes
- Fix pdf
hi_res
partitioning failure when pdfminer fails. Implemented logic to fall back to the "inferred_layout + OCR" if pdfminer fails in thehi_res
strategy. - Fix a bug where image can be scaled too large for tesseract Adds a limit to prevent auto-scaling an image beyond the maximum size
tesseract
can handle for ocr layout detection - Update partition_csv to handle different delimiters CSV files containing both non-comma delimiters and commas in the data were throwing an error in Pandas.
partition_csv
now identifies the correct delimiter before the file is processed. - partition returning cid code in
hi_res
occasionally pdfminer can fail to decode the text in an pdf file and return cid code as text. Now when this happens the text from OCR is used.
0.11.2
0.11.2
Enhancements
- Updated Documentation: (i) Added examples, and (ii) API Documentation, including Usage, SDKs, Azure Marketplace, and parameters and validation errors.
Features
- Add Pinecone destination connector. Problem: After ingesting data from a source, users might want to produce embeddings for their data and write these into a vector DB. Pinecone is an option among these vector databases. Feature: Added Pinecone destination connector to be able to ingest documents from any supported source, embed them and write the embeddings / documents into Pinecone.
Fixes
- Process chunking parameter names in ingest correctly Solves a bug where chunking parameters weren't being processed and used by ingest cli by renaming faulty parameter names and prepends; adds relevant parameters to ingest pinecone test to verify that the parameters are functional.
0.11.1
0.11.1
Enhancements
-
Use
pikepdf
to repair invalid PDF structure for PDFminer when we see errorPSSyntaxError
when PDFminer opens the document and creates the PDFminer pages object or processes a single PDF page. -
Batch Source Connector support For instances where it is more optimal to read content from a source connector in batches, a new batch ingest doc is added which created multiple ingest docs after reading them in in batches per process.
Features
- Staging Brick for Coco Format Staging brick which converts a list of Elements into Coco Format.
- Adds HubSpot connector Adds connector to retrieve call, communications, emails, notes, products and tickets from HubSpot
Fixes
- Do not extract text of
<style>
tags in HTML.<style>
tags containing CSS in invalid positions previously contributed to element text. Do not consider text node of a<style>
element as textual content. - Fix DOCX merged table cell repeats cell text. Only include text for a merged cell, not for each underlying cell spanned by the merge.
- Fix tables not extracted from DOCX header/footers. Headers and footers in DOCX documents skip tables defined in the header and commonly used for layout/alignment purposes. Extract text from tables as a string and include in the
Header
andFooter
document elements. - Fix output filepath for fsspec-based source connectors. Previously the base directory was being included in the output filepath unnecessarily.
0.11.0
0.11.0
Enhancements
- Add a class for the strategy constants. Add a class
PartitionStrategy
for the strategy constants and use the constants to replace strategy strings. - Temporary Support for paddle language parameter. User can specify default langage code for paddle with ENV
DEFAULT_PADDLE_LANG
before we have the language mapping for paddle. - Improve DOCX page-break fidelity. Improve page-break fidelity such that a paragraph containing a page-break is split into two elements, one containing the text before the page-break and the other the text after. Emit the PageBreak element between these two and assign the correct page-number (n and n+1 respectively) to the two textual elements.
Features
- Add ad-hoc fields to ElementMetadata instance. End-users can now add their own metadata fields simply by assigning to an element-metadata attribute-name of their choice, like
element.metadata.coefficient = 0.58
. These fields will round-trip through JSON and can be accessed with dotted notation. - MongoDB Destination Connector New destination connector added to all CLI ingest commands to support writing partitioned json output to mongodb.
Fixes
- Fix
TYPE_TO_TEXT_ELEMENT_MAP
UpdatedFigure
mapping fromFigureCaption
toImage
. - Handle errors when extracting PDF text Certain pdfs throw unexpected errors when being opened by
pdfminer
, causingpartition_pdf()
to fail. We expect to be able to partition smoothly using an alternative strategy if text extraction doesn't work. Added exception handling to handle unexpected errors when extracting pdf text and to help determine pdf strategy. - Fix
fast
strategy fall back toocr_only
Thefast
strategy should not fall back to a more expensive strategy. - Remove default user ./ssh folder The default notebook user during image build would create the known_hosts file with incorrect ownership, this is legacy and no longer needed so it was removed.
- Include
languages
in metadata when partitioningstrategy=hi_res
orfast
User definedlanguages
was previously used for text detection, but not included in the resulting element metadata for some strategies.languages
will now be included in the metadata regardless of partition strategy for pdfs and images. - Handle a case where Paddle returns a list item in ocr_data as None In partition, while parsing PaddleOCR data, it was assumed that PaddleOCR does not return None for any list item in ocr_data. Removed the assumption by skipping the text region whenever this happens.
- Fix some pdfs returning
KeyError: 'N'
Certain pdfs were throwing this error when being opened by pdfminer. Added a wrapper function for pdfminer that allows these documents to be partitioned. - Fix mis-splits on
Table
chunks. Remedies repeated appearance of full.text_as_html
on metadata of eachTableChunk
split from aTable
element too large to fit in the chunking window. - Import tables_agent from inference so that we don't have to initialize a global table agent in unstructured OCR again
- Fix empty table is identified as bulleted-table. A table with no text content was mistakenly identified as a bulleted-table and processed by the wrong branch of the initial HTML partitioner.
- Fix partition_html() emits empty (no text) tables. A table with cells nested below a
<thead>
or<tfoot>
element was emitted as a table element having no text and unparseable HTML inelement.metadata.text_as_html
. Do not emit empty tables to the element stream. - Fix HTML
element.metadata.text_as_html
contains spurious
elements in invalid locations. The HTML generated for thetext_as_html
metadata for HTML tables contained<br>
elements invalid locations like between<table>
and<tr>
. Change the HTML generator such that these do not appear. - Fix HTML table cells enclosed in and elements are dropped. HTML table cells nested in a
<thead>
or<tfoot>
element were not detected and the text in those cells was omitted from the table element text and.text_as_html
. Detect table rows regardless of the semantic tag they may be nested in. - Remove whitespace padding from
.text_as_html
.tabulate
inserts padding spaces to achieve visual alignment of columns in HTML tables it generates. Add our own HTML generator to do this simple job and omit that padding as well as newlines ("\n") used for human readability. - Fix local connector with absolute input path When passed an absolute filepath for the input document path, the local connector incorrectly writes the output file to the input file directory. This fixes such that the output in this case is written to
output-dir/input-filename.json
0.10.30
0.10.30
Enhancements
- Support nested DOCX tables. In DOCX, like HTML, a table cell can itself contain a table. In this case, create nested HTML tables to reflect that structure and create a plain-text table with captures all the text in nested tables, formatting it as a reasonable facsimile of a table.
- Add connection check to ingest connectors Each source and destination connector now support a
check_connection()
method which makes sure a valid connection can be established with the source/destination given any authentication credentials in a lightweight request.
Features
- Add functionality to do a second OCR on cropped table images. Changes to the values for scaling ENVs affect entire page OCR output(OCR regression) so we now do a second OCR for tables.
- Adds ability to pass timeout for a request when partitioning via a
url
.partition
now accepts a new optional parameterrequest_timeout
which if set will prevent anyrequests.get
from hanging indefinitely and instead will raise a timeout error. This is useful when partitioning a url that may be slow to respond or may not respond at all.
Fixes
- Fix logic that determines pdf auto strategy. Previously,
_determine_pdf_auto_strategy
returnedhi_res
strategy only ifinfer_table_structure
was true. It now returns thehi_res
strategy if eitherinfer_table_structure
orextract_images_in_pdf
is true. - Fix invalid coordinates when parsing tesseract ocr data. Previously, when parsing tesseract ocr data, the ocr data had invalid bboxes if zoom was set to
0
. A logical check is now added to avoid such error. - Fix ingest partition parameters not being passed to the api. When using the --partition-by-api flag via unstructured-ingest, none of the partition arguments are forwarded, meaning that these options are disregarded. With this change, we now pass through all of the relevant partition arguments to the api. This allows a user to specify all of the same partition arguments they would locally and have them respected when specifying --partition-by-api.
- Support tables in section-less DOCX. Generalize solution for MS Chat Transcripts exported as DOCX by including tables in the partitioned output when present.
- Support tables that contain only numbers when partitioning via
ocr_only
Tables that contain only numbers are returned as floats in a pandas.DataFrame when the image is converted from.image_to_data()
. An AttributeError was raised downstream when trying to.strip()
the floats. - Improve DOCX page-break detection. DOCX page breaks are reliably indicated by
w:lastRenderedPageBreak
elements present in the document XML. Page breaks are NOT reliably indicated by "hard" page-breaks inserted by the author and when present are redundant to aw:lastRenderedPageBreak
element so cause over-counting if used. Use rendered page-breaks only.
0.10.29
0.10.29
Enhancements
- Add include_header argument for partition_csv and partition_tsv Now supports retaining header rows in CSV and TSV documents element partitioning.
- Add retry logic for all source connectors All http calls being made by the ingest source connectors have been isolated and wrapped by the
SourceConnectionNetworkError
custom error, which triggers the retry logic, if enabled, in the ingest pipeline. - Google Drive source connector supports credentials from memory Originally, the connector expected a filepath to pull the credentials from when creating the client. This was expanded to support passing that information from memory as a dict if access to the file system might not be available.
- Add support for generic partition configs in ingest cli Along with the explicit partition options supported by the cli, an
additional_partition_args
arg was added to allow users to pass in any other arguments that should be added when calling partition(). This helps keep any changes to the input parameters of the partition() exposed in the CLI. - Map full output schema for table-based destination connectors A full schema was introduced to map the type of all output content from the json partition output and mapped to a flattened table structure to leverage table-based destination connectors. The delta table destination connector was updated at the moment to take advantage of this.
- Incorporate multiple embedding model options into ingest, add diff test embeddings Problem: Ingest pipeline already supported embedding functionality, however users might want to use different types of embedding providers. Enhancement: Extend ingest pipeline so that users can specify and embed via a particular embedding provider from a range of options. Also adds a diff test to compare output from an embedding module with the expected output
Features
- Allow setting table crop parameter In certain circumstances, adjusting the table crop padding may improve table.
Fixes
- Fixes
partition_text
to prevent empty elements Adds a check to filter out empty bullets. - Handle empty string for
ocr_languages
with values forlanguages
Some API users ran into an issue with sendinglanguages
params because the API defaulted to also using an empty string forocr_languages
. This update handles situations wherelanguages
is defined andocr_languages
is an empty string. - Fix PDF tried to loop through None Previously the PDF annotation extraction tried to loop through
annots
that resolved out as None. A logical check added to avoid such error. - Ingest session handler not being shared correctly All ingest docs that leverage the session handler should only need to set it once per process. It was recreating it each time because the right values weren't being set nor available given how dataclasses work in python.
- Ingest download-only fix. Previously the download only flag was being checked after the doc factory pipeline step, which occurs before the files are actually downloaded by the source node. This check was moved after the source node to allow for the files to be downloaded first before exiting the pipeline.
- Fix flaky chunk-metadata. Prior implementation was sensitive to element order in the section resulting in metadata values sometimes being dropped. Also, not all metadata items can be consolidated across multiple elements (e.g. coordinates) and so are now dropped from consolidated metadata.
- Fix tesseract error
Estimating resolution as X
leaded by invalid language parameters input. Proceed with defalut languageeng
whenlang.py
fails to find valid language code for tesseract, so that we don't pass an empty string to tesseract CLI and raise an exception in downstream.
0.10.28
0.10.28
Enhancements
- Add element type CI evaluation workflow Adds element type frequency evaluation metrics to the current ingest workflow to measure the performance of each file extracted as well as aggregated-level performance.
- Add table structure evaluation helpers Adds functions to evaluate the similarity between predicted table structure and actual table structure.
- Use
yolox
by default for table extraction when partitioning pdf/imageyolox
model provides higher recall of the table regions than the quantized version and it is now the default element detection model wheninfer_table_structure=True
for partitioning pdf/image files - Remove pdfminer elements from inside tables Previously, when using
hi_res
some elements where extracted using pdfminer too, so we removed pdfminer from the tables pipeline to avoid duplicated elements. - Fsspec downstream connectors New destination connector added to ingest CLI, users may now use
unstructured-ingest
to write to any of the following:- Azure
- Box
- Dropbox
- Google Cloud Service
Features
- Update
ocr_only
strategy inpartition_pdf()
Adds the functionality to get accurate coordinate data when partitioning PDFs and Images with theocr_only
strategy.
Fixes
- Fixes issue where tables from markdown documents were being treated as text Problem: Tables from markdown documents were being treated as text, and not being extracted as tables. Solution: Enable the
tables
extension when instantiating thepython-markdown
object. Importance: This will allow users to extract structured data from tables in markdown documents. - Fix wrong logger for paddle info Replace the logger from unstructured-inference with the logger from unstructured for paddle_ocr.py module.
- Fix ingest pipeline to be able to use chunking and embedding together Problem: When ingest pipeline was using chunking and embedding together, embedding outputs were empty and the outputs of chunking couldn't be re-read into memory and be forwarded to embeddings. Fix: Added CompositeElement type to TYPE_TO_TEXT_ELEMENT_MAP to be able to process CompositeElements with unstructured.staging.base.isd_to_elements
- Fix unnecessary mid-text chunk-splitting. The "pre-chunker" did not consider separator blank-line ("\n\n") length when grouping elements for a single chunk. As a result, sections were frequently over-populated producing a over-sized chunk that required mid-text splitting.
- Fix frequent dissociation of title from chunk. The sectioning algorithm included the title of the next section with the prior section whenever it would fit, frequently producing association of a section title with the prior section and dissociating it from its actual section. Fix this by performing combination of whole sections only.
- Fix PDF attempt to get dict value from string. Fixes a rare edge case that prevented some PDF's from being partitioned. The
get_uris_from_annots
function tried to access the dictionary value of a string instance variable. AssignNone
to the annotation variable if the instance type is not dictionary to avoid the erroneous attempt.
0.10.27
0.10.27
Enhancements
- Leverage dict to share content across ingest pipeline To share the ingest doc content across steps in the ingest pipeline, this was updated to use a multiprocessing-safe dictionary so changes get persisted and each step has the option to modify the ingest docs in place.
Features
Fixes
- Removed
ebooklib
as a dependencyebooklib
is licensed under AGPL3, which is incompatible with the Apache 2.0 license. Thus it is being removed. - Caching fixes in ingest pipeline Previously, steps like the source node were not leveraging parameters such as
re_download
to dictate if files should be forced to redownload rather than use what might already exist locally.
0.10.26
0.10.26
Enhancements
- Add CI evaluation workflow Adds evaluation metrics to the current ingest workflow to measure the performance of each file extracted as well as aggregated-level performance.
Features
- Functionality to catch and classify overlapping/nested elements Method to identify overlapping-bboxes cases within detected elements in a document. It returns two values: a boolean defining if there are overlapping elements present, and a list reporting them with relevant metadata. The output includes information about the
overlapping_elements
,overlapping_case
,overlapping_percentage
,largest_ngram_percentage
,overlap_percentage_total
,max_area
,min_area
, andtotal_area
. - Add Local connector source metadata python's os module used to pull stats from local file when processing via the local connector and populates fields such as last modified time, created time.
- Add Local connector source metadata. python's os module used to pull stats from local file when processing via the local connector and populates fields such as last modified time, created time.
Fixes
- Fixes elements partitioned from an image file missing certain metadata Metadata for image files, like file type, was being handled differently from other file types. This caused a bug where other metadata, like the file name, was being missed. This change brought metadata handling for image files to be more in line with the handling for other file types so that file name and other metadata fields are being captured.
- Adds
typing-extensions
as an explicit dependency This package is an implicit dependency, but the module is being imported directly inunstructured.documents.elements
so the dependency should be explicit in case changes in other dependencies lead totyping-extensions
being dropped as a dependency. - Stop passing
extract_tables
tounstructured-inference
since it is now supported inunstructured
instead Table extraction previously occurred inunstructured-inference
, but that logic, except for the table model itself, is now a part of theunstructured
library. Thus the parameter triggering table extraction is no longer passed to theunstructured-inference
package. Also noted the table output regression for PDF files. - Fix a bug in Table partitioning Previously the
skip_infer_table_types
variable used inpartition
was not being passed down to specific file partitioners. Now you can utilize theskip_infer_table_types
list variable when callingpartition
to specify the filetypes for which you want to skip table extraction, or theinfer_table_structure
boolean variable on the file specific partitioning function. - Fix partition docx without sections Some docx files, like those from teams output, do not contain sections and it would produce no results because the code assumes all components are in sections. Now if no sections is detected from a document we iterate through the paragraphs and return contents found in the paragraphs.
- Fix out-of-order sequencing of split chunks. Fixes behavior where "split" chunks were inserted at the beginning of the chunk sequence. This would produce a chunk sequence like [5a, 5b, 3a, 3b, 1, 2, 4] when sections 3 and 5 exceeded
max_characters
. - Deserialization of ingest docs fixed When ingest docs are being deserialized as part of the ingest pipeline process (cli), there were certain fields that weren't getting persisted (metadata and date processed). The from_dict method was updated to take these into account and a unit test added to check.
- Map source cli command configs when destination set Due to how the source connector is dynamically called when the destination connector is set via the CLI, the configs were being set incorrectoy, causing the source connector to break. The configs were fixed and updated to take into account Fsspec-specific connectors.