Skip to content

Commit 724e2d2

Browse files
NastyBogetsunveilalexander1999-hubAlexander Golodkov
authored
new version 2.3 (#498)
Co-authored-by: Andrey Mikhailov <mikhailov@icc.ru> Co-authored-by: Alexander Golodkov <55749660+alexander1999-hub@users.noreply.github.com> Co-authored-by: Alexander Golodkov <golodkov@ispras.ru>
1 parent 765aae2 commit 724e2d2

File tree

111 files changed

+2683
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2683
-316
lines changed

.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ exclude =
2828
*__init__.py,
2929
resources,
3030
venv,
31+
.venv,
3132
build,
3233
dedoc.egg-info,
3334
docs/_build,
@@ -48,5 +49,5 @@ per-file-ignores =
4849
scripts/*:T201
4950
scripts/benchmark_pdf_performance*:JS101
5051
tests/custom_test_runner.py:ANN001,ANN201,ANN202,ANN204,N802
51-
docs/source/_static/code_examples/*:I251
52+
docs/source/_static/code_examples/*:I251,T201
5253
docs/source/_static/code_examples/langchain/*:FOL001,FOL002,FOL003,FOL004,FOL005,I100,I202,I251

.github/workflows/docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ jobs:
3333
python dedoc_usage_tutorial.py
3434
python dedoc_add_new_doc_type_tutorial.py
3535
python dedoc_add_new_structure_type_tutorial.py
36+
python dedoc_using_patterns_tutorial.py

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
rev: 5.0.4
44
hooks:
55
- id: flake8
6-
exclude: \.github|.*__init__\.py|resources|docs|venv|build|dedoc\.egg-info|scripts/fintoc2022/metric.py
6+
exclude: \.github|.*__init__\.py|resources|docs|venv|\.venv|build|dedoc\.egg-info|scripts/fintoc2022/metric.py
77
args:
88
- "--config=.flake8"
99
additional_dependencies: [

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Dedoc
22

3+
[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-2ba2d9.svg)](https://t.me/dedoc_chat)
34
[![image](https://img.shields.io/pypi/pyversions/dedoc.svg)](https://pypi.python.org/pypi/dedoc)
45
[![GitHub release](https://img.shields.io/github/release/ispras/dedoc.svg)](https://github.com/ispras/dedoc/releases/)
56
[![PyPI version](https://badge.fury.io/py/dedoc.svg)](https://badge.fury.io/py/dedoc)
@@ -94,6 +95,12 @@ Relevant documentation of dedoc is available [here](https://dedoc.readthedocs.io
9495
* Article on habr.com [Dedoc: как автоматически извлечь из текстового документа всё и даже немного больше](https://habr.com/ru/companies/isp_ras/articles/779390/) in Russian (2023)
9596
* Article [Dedoc: A Universal System for Extracting Content and Logical Structure From Textual Documents](https://ieeexplore.ieee.org/abstract/document/10508151/) in English (2023)
9697

98+
# Join Our Community
99+
100+
Have questions or want to discuss Dedoc? Join our [Telegram chat](https://t.me/dedoc_chat) and connect with the community and the developers.
101+
102+
Join our [Telegram channel](https://t.me/dedoc_channel) to get notifications about the most recent updates.
103+
97104
# Installation instructions
98105

99106
This project has a REST api and you can run it in Docker container.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.7
1+
2.3

dedoc/api/api_args.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class QueryParameters:
99
# type of document structure parsing
1010
document_type: str = Form("", enum=["", "law", "tz", "diploma", "article", "fintoc"], description="Document domain")
11+
patterns: str = Form("", description='Patterns for default document type (when document_type="")')
1112
structure_type: str = Form("tree", enum=["linear", "tree"], description="Output structure type")
1213
return_format: str = Form("json", enum=["json", "html", "plain_text", "tree", "collapsed_tree", "ujson", "pretty_json"],
1314
description="Response representation, most types (except json) are used for debug purposes only")
@@ -39,6 +40,7 @@ class QueryParameters:
3940
'"no_change" - set vertical orientation of the document without using an orientation classifier')
4041
need_header_footer_analysis: str = Form("false", enum=["true", "false"], description="Exclude headers and footers from PDF parsing result")
4142
need_binarization: str = Form("false", enum=["true", "false"], description="Binarize document pages (for images or PDF without a textual layer)")
43+
need_gost_frame_analysis: str = Form("false", enum=["true", "false"], description="Parameter for detecting and ignoring GOST frame of the document")
4244

4345
# other formats handling
4446
delimiter: Optional[str] = Form(None, description="Column separator for CSV files")

dedoc/api/schema/annotation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ class Annotation(BaseModel):
55
"""
66
The piece of information about the text line: it's appearance or links to another document object.
77
For example Annotation(1, 13, "italic", "True") says that text between 1st and 13th symbol was written in italic.
8+
9+
:ivar start: start of the annotated text
10+
:ivar end: end of the annotated text (end isn't included)
11+
:ivar name: annotation's name, specific for each type of annotation
12+
:ivar value: information about annotated text, depends on the type of annotation, e.g. "True"/"False", "10.0", etc.
13+
14+
:vartype start: int
15+
:vartype end: int
16+
:vartype name: str
17+
:vartype value: str
818
"""
919
start: int = Field(description="Start of the annotated text", example=0)
1020
end: int = Field(description="End of the annotated text (end isn't included)", example=5)

dedoc/api/schema/cell_with_meta.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
class CellWithMeta(BaseModel):
99
"""
1010
Holds the information about the cell: list of lines and cell properties (rowspan, colspan, invisible).
11+
12+
:ivar lines: list of textual lines of the cell
13+
:ivar colspan: number of columns to span (for cells merged horizontally)
14+
:ivar rowspan: number of rows to span (for cells merged vertically)
15+
:ivar invisible: indicator for displaying or hiding cell text - cells that are merged with others are hidden (for HTML display)
16+
17+
:vartype lines: List[LineWithMeta]
18+
:vartype colspan: int
19+
:vartype rowspan: int
20+
:vartype invisible: bool
1121
"""
1222
lines: List[LineWithMeta] = Field(description="Textual lines of the cell with annotations")
1323
rowspan: int = Field(description="Number of rows to span like in HTML format", example=1)

dedoc/api/schema/document_content.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
class DocumentContent(BaseModel):
1010
"""
1111
Content of the document - structured text and tables.
12+
13+
:ivar tables: list of document tables
14+
:ivar structure: tree structure of the document nodes with text and additional metadata
15+
16+
:vartype tables: List[Table]
17+
:vartype structure: TreeNode
1218
"""
1319
structure: TreeNode = Field(description="Tree structure where content of the document is organized")
1420
tables: List[Table] = Field(description="List of document tables")

dedoc/api/schema/document_metadata.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
class DocumentMetadata(BaseModel):
55
"""
66
Document metadata like its name, size, author, etc.
7+
8+
:ivar file_name: original document name (before rename and conversion, so it can contain non-ascii symbols, spaces and so on)
9+
:ivar temporary_file_name: file name during parsing (unique name after rename and conversion)
10+
:ivar size: size of the original file in bytes
11+
:ivar modified_time: time of the last modification in unix time format (seconds since the epoch)
12+
:ivar created_time: time of the creation in unixtime
13+
:ivar access_time: time of the last access to the file in unixtime
14+
:ivar file_type: mime type of the file
15+
:ivar uid: document unique identifier (useful for attached files)
16+
17+
:vartype file_name: str
18+
:vartype temporary_file_name: str
19+
:vartype size: int
20+
:vartype modified_time: int
21+
:vartype created_time: int
22+
:vartype access_time: int
23+
:vartype file_type: str
24+
:vartype uid: str
25+
26+
Additional variables may be added with other file metadata.
727
"""
828
class Config:
929
extra = Extra.allow

0 commit comments

Comments
 (0)