reftable 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reftable-1.0.0/LICENSE +21 -0
- reftable-1.0.0/PKG-INFO +33 -0
- reftable-1.0.0/README +1 -0
- reftable-1.0.0/pyproject.toml +116 -0
- reftable-1.0.0/reftable/__init__.py +19 -0
- reftable-1.0.0/reftable/__main__.py +13 -0
- reftable-1.0.0/reftable/abbrev/__init__.py +41 -0
- reftable-1.0.0/reftable/abbrev/geometry.py +69 -0
- reftable-1.0.0/reftable/abbrev/parser.py +36 -0
- reftable-1.0.0/reftable/abbrev/simple.py +66 -0
- reftable-1.0.0/reftable/cli.py +76 -0
- reftable-1.0.0/reftable/feature/__init__.py +8 -0
- reftable-1.0.0/reftable/feature/abbrev.py +67 -0
- reftable-1.0.0/reftable/feature/figure.py +51 -0
- reftable-1.0.0/reftable/feature/table.py +89 -0
- reftable-1.0.0/reftable/feature/toc.py +103 -0
- reftable-1.0.0/reftable/figure/__init__.py +19 -0
- reftable-1.0.0/reftable/figure/column.py +75 -0
- reftable-1.0.0/reftable/figure/normal.py +75 -0
- reftable-1.0.0/reftable/figure/strategy.py +44 -0
- reftable-1.0.0/reftable/horizontals.py +101 -0
- reftable-1.0.0/reftable/likelihood.py +128 -0
- reftable-1.0.0/reftable/pageselector.py +101 -0
- reftable-1.0.0/reftable/path.py +26 -0
- reftable-1.0.0/reftable/toc/__init__.py +58 -0
- reftable-1.0.0/reftable/toc/basic/__init__.py +8 -0
- reftable-1.0.0/reftable/toc/basic/group.py +62 -0
- reftable-1.0.0/reftable/toc/basic/layout.py +77 -0
- reftable-1.0.0/reftable/toc/basic/lineregex.py +240 -0
- reftable-1.0.0/reftable/toc/create.py +302 -0
- reftable-1.0.0/reftable/toc/decider.py +101 -0
- reftable-1.0.0/reftable/toc/run.py +54 -0
- reftable-1.0.0/reftable/toc/strategy/__init__.py +134 -0
- reftable-1.0.0/reftable/toc/strategy/balance.py +116 -0
- reftable-1.0.0/reftable/toc/strategy/geometry.py +136 -0
- reftable-1.0.0/reftable/toc/strategy/georegex.py +73 -0
- reftable-1.0.0/reftable/toc/strategy/pagetop.py +81 -0
- reftable-1.0.0/reftable/toc/strategy/regex.py +156 -0
- reftable-1.0.0/reftable.egg-info/PKG-INFO +33 -0
- reftable-1.0.0/reftable.egg-info/SOURCES.txt +43 -0
- reftable-1.0.0/reftable.egg-info/dependency_links.txt +1 -0
- reftable-1.0.0/reftable.egg-info/entry_points.txt +2 -0
- reftable-1.0.0/reftable.egg-info/requires.txt +18 -0
- reftable-1.0.0/reftable.egg-info/top_level.txt +1 -0
- reftable-1.0.0/setup.cfg +4 -0
reftable-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Helmut Konrad Schewe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
reftable-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: reftable
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Author-email: Helmut Konrad Schewe <helmutus@outlook.com>
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/anaticulae/reftable
|
|
7
|
+
Project-URL: Repository, https://github.com/anaticulae/reftable
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: configos<2.0.0,>=1.0.4
|
|
15
|
+
Requires-Dist: elementae<2.0.0,>=1.0.1
|
|
16
|
+
Requires-Dist: geostrat<2.0.0,>=1.5.1
|
|
17
|
+
Requires-Dist: iamraw<5.0.0,>=4.92.0
|
|
18
|
+
Requires-Dist: utilo<3.0.0,>=2.109.1
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: capita-ref<2.0.0,>=1.0.1; extra == "dev"
|
|
21
|
+
Requires-Dist: capita<2.0.0,>=1.25.3; extra == "dev"
|
|
22
|
+
Requires-Dist: cleanup<2.0.0,>=1.0.4; extra == "dev"
|
|
23
|
+
Requires-Dist: gennex==1.0.3; extra == "dev"
|
|
24
|
+
Requires-Dist: groupmes==1.1.0; extra == "dev"
|
|
25
|
+
Requires-Dist: headnote==1.0.3; extra == "dev"
|
|
26
|
+
Requires-Dist: hoverpower==1.5.2; extra == "dev"
|
|
27
|
+
Requires-Dist: ibidem==1.0.2; extra == "dev"
|
|
28
|
+
Requires-Dist: pagenumber==1.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: rawmaker==2.40.5; extra == "dev"
|
|
30
|
+
Requires-Dist: utilotest==1.0.4; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# reftable
|
reftable-1.0.0/README
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# reftable
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "reftable"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = ""
|
|
5
|
+
requires-python = ">=3.12"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Helmut Konrad Schewe", email = "helmutus@outlook.com" },
|
|
8
|
+
]
|
|
9
|
+
dependencies = [
|
|
10
|
+
"configos>=1.0.4,<2.0.0",
|
|
11
|
+
"elementae>=1.0.1,<2.0.0",
|
|
12
|
+
"geostrat>=1.5.1,<2.0.0",
|
|
13
|
+
"iamraw>=4.92.0,<5.0.0",
|
|
14
|
+
"utilo>=2.109.1,<3.0.0",
|
|
15
|
+
]
|
|
16
|
+
keywords = []
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
]
|
|
22
|
+
license = "MIT"
|
|
23
|
+
license-files = [
|
|
24
|
+
"LICENSE",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.readme]
|
|
28
|
+
file = "README"
|
|
29
|
+
content-type = "text/markdown"
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = [
|
|
33
|
+
"capita-ref>=1.0.1,<2.0.0",
|
|
34
|
+
"capita>=1.25.3,<2.0.0",
|
|
35
|
+
"cleanup>=1.0.4,<2.0.0",
|
|
36
|
+
"gennex==1.0.3",
|
|
37
|
+
"groupmes==1.1.0",
|
|
38
|
+
"headnote==1.0.3",
|
|
39
|
+
"hoverpower==1.5.2",
|
|
40
|
+
"ibidem==1.0.2",
|
|
41
|
+
"pagenumber==1.0.0",
|
|
42
|
+
"rawmaker==2.40.5",
|
|
43
|
+
"utilotest==1.0.4",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/anaticulae/reftable"
|
|
48
|
+
Repository = "https://github.com/anaticulae/reftable"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
reftable = "reftable.cli:main"
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = [
|
|
55
|
+
"setuptools>=83.0.0",
|
|
56
|
+
"wheel>=0.47.0",
|
|
57
|
+
]
|
|
58
|
+
build-backend = "setuptools.build_meta"
|
|
59
|
+
|
|
60
|
+
[tool.semantic_release]
|
|
61
|
+
version_toml = [
|
|
62
|
+
"pyproject.toml:project.version",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.semantic_release.changelog]
|
|
66
|
+
mode = "init"
|
|
67
|
+
output_format = "md"
|
|
68
|
+
|
|
69
|
+
[tool.semantic_release.changelog.default_templates]
|
|
70
|
+
changelog_file = "CHANGELOG"
|
|
71
|
+
|
|
72
|
+
[tool.semantic_release.commit_parser_options]
|
|
73
|
+
patch_tags = [
|
|
74
|
+
"build",
|
|
75
|
+
"chore",
|
|
76
|
+
"ci",
|
|
77
|
+
"deps",
|
|
78
|
+
"docs",
|
|
79
|
+
"fix",
|
|
80
|
+
"perf",
|
|
81
|
+
"refactor",
|
|
82
|
+
"style",
|
|
83
|
+
"test",
|
|
84
|
+
]
|
|
85
|
+
minor_tags = [
|
|
86
|
+
"feat",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[tool.setuptools.packages.find]
|
|
90
|
+
where = [
|
|
91
|
+
".",
|
|
92
|
+
]
|
|
93
|
+
include = [
|
|
94
|
+
"reftable",
|
|
95
|
+
"reftable.abbrev",
|
|
96
|
+
"reftable.feature",
|
|
97
|
+
"reftable.figure",
|
|
98
|
+
"reftable.toc",
|
|
99
|
+
"reftable.toc.basic",
|
|
100
|
+
"reftable.toc.strategy",
|
|
101
|
+
]
|
|
102
|
+
exclude = [
|
|
103
|
+
"tests*",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[tool.hoverpower]
|
|
107
|
+
packages = [
|
|
108
|
+
"BACHELOR",
|
|
109
|
+
"BOOK",
|
|
110
|
+
"DISS",
|
|
111
|
+
"DOCU",
|
|
112
|
+
"HOME",
|
|
113
|
+
"MASTER",
|
|
114
|
+
"PAPER",
|
|
115
|
+
"TECH",
|
|
116
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2022-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
#==============================================================================
|
|
9
|
+
|
|
10
|
+
import importlib.metadata
|
|
11
|
+
import os
|
|
12
|
+
|
|
13
|
+
import reftable.path
|
|
14
|
+
|
|
15
|
+
PROCESS = 'reftable'
|
|
16
|
+
|
|
17
|
+
__version__ = importlib.metadata.version(PROCESS)
|
|
18
|
+
|
|
19
|
+
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2022-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
|
|
10
|
+
from reftable.cli import main
|
|
11
|
+
|
|
12
|
+
if __name__ == "__main__":
|
|
13
|
+
main()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
"""Abbreviation
|
|
10
|
+
============
|
|
11
|
+
|
|
12
|
+
Examples:
|
|
13
|
+
|
|
14
|
+
* homework/page_50_math.pdf:page6
|
|
15
|
+
* master/page_116_images_toc_formular.pdf:95
|
|
16
|
+
|
|
17
|
+
TODO: Abbreviation creation tool
|
|
18
|
+
TODO: Symbol collector
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import abc
|
|
22
|
+
import dataclasses
|
|
23
|
+
|
|
24
|
+
import iamraw
|
|
25
|
+
import texmex
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclasses.dataclass
|
|
29
|
+
class AbbreviationData:
|
|
30
|
+
normal: texmex.PTNs = None
|
|
31
|
+
oneline: texmex.PTNs = None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class AbbreviationExtractorStrategy(abc.ABC):
|
|
35
|
+
|
|
36
|
+
def __init__(self, loaded: AbbreviationData):
|
|
37
|
+
self.loaded = loaded
|
|
38
|
+
|
|
39
|
+
@abc.abstractmethod
|
|
40
|
+
def result(self) -> iamraw.AbbreviationResult:
|
|
41
|
+
pass
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
"""Abbreviation Parser: Geometry Strategy
|
|
10
|
+
======================================
|
|
11
|
+
|
|
12
|
+
This approach splits the page in two columns and detect a left shortcut
|
|
13
|
+
and a right description column. It is required that the distance between
|
|
14
|
+
left and right column is not ?too? tight.
|
|
15
|
+
|
|
16
|
+
Working Examples
|
|
17
|
+
----------------
|
|
18
|
+
|
|
19
|
+
* bachelor37: page 2
|
|
20
|
+
|
|
21
|
+
Not working
|
|
22
|
+
-----------
|
|
23
|
+
|
|
24
|
+
* homework50: columns are to tight together
|
|
25
|
+
|
|
26
|
+
Nearly working
|
|
27
|
+
--------------
|
|
28
|
+
|
|
29
|
+
* master116: improve layout parser
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
import geostrat
|
|
33
|
+
import iamraw
|
|
34
|
+
import texmex
|
|
35
|
+
import utilo
|
|
36
|
+
|
|
37
|
+
import reftable.abbrev
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class GeometryAbbreviationParser(reftable.abbrev.AbbreviationExtractorStrategy):
|
|
41
|
+
|
|
42
|
+
def result(self) -> iamraw.AbbreviationResult:
|
|
43
|
+
ready = iamraw.AbbreviationResult()
|
|
44
|
+
for page in self.loaded.normal:
|
|
45
|
+
parsed = parse_page(page)
|
|
46
|
+
if parsed is None:
|
|
47
|
+
utilo.info(f'could not parse page: {page.page}')
|
|
48
|
+
continue
|
|
49
|
+
for item in parsed:
|
|
50
|
+
ready.append(item)
|
|
51
|
+
ready.pdfpages.append(page.page)
|
|
52
|
+
return ready
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def parse_page(page: texmex.PTN) -> iamraw.Abbreviations:
|
|
56
|
+
parsed = geostrat.dc_parse_page(page)
|
|
57
|
+
if not parsed:
|
|
58
|
+
return None
|
|
59
|
+
result = []
|
|
60
|
+
for short, description in parsed:
|
|
61
|
+
short, description = short.strip(), description.strip()
|
|
62
|
+
description = description.lstrip('-')
|
|
63
|
+
result.append(
|
|
64
|
+
iamraw.Abbreviation(
|
|
65
|
+
short=short,
|
|
66
|
+
description=description,
|
|
67
|
+
position=iamraw.AbbreviationPosition(page=page.page),
|
|
68
|
+
))
|
|
69
|
+
return result
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
|
|
10
|
+
import iamraw
|
|
11
|
+
|
|
12
|
+
import reftable.abbrev
|
|
13
|
+
import reftable.abbrev.geometry
|
|
14
|
+
import reftable.abbrev.simple
|
|
15
|
+
|
|
16
|
+
STRATEGIES = [
|
|
17
|
+
reftable.abbrev.simple.SimpleAbbreviationParser,
|
|
18
|
+
reftable.abbrev.geometry.GeometryAbbreviationParser,
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def parse(data: reftable.abbrev.AbbreviationData) -> iamraw.AbbreviationResult:
|
|
23
|
+
assert isinstance(data.normal, list), type(data)
|
|
24
|
+
assert isinstance(data.oneline, list), type(data)
|
|
25
|
+
parsed = [strategy(data).result() for strategy in STRATEGIES]
|
|
26
|
+
judged = judge(parsed)
|
|
27
|
+
return judged
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def judge(results) -> iamraw.AbbreviationResult:
|
|
31
|
+
simple = results[0]
|
|
32
|
+
geometry = results[1]
|
|
33
|
+
more_than_double_parsed = (len(geometry) * 2) < len(simple)
|
|
34
|
+
if more_than_double_parsed:
|
|
35
|
+
return simple
|
|
36
|
+
return geometry
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
|
|
10
|
+
import elementae.headline.lookup
|
|
11
|
+
import iamraw
|
|
12
|
+
import utilo
|
|
13
|
+
|
|
14
|
+
import reftable.abbrev
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SimpleAbbreviationParser(reftable.abbrev.AbbreviationExtractorStrategy):
|
|
18
|
+
|
|
19
|
+
def result(self) -> iamraw.AbbreviationResult:
|
|
20
|
+
ready = iamraw.AbbreviationResult()
|
|
21
|
+
for page in self.loaded.oneline:
|
|
22
|
+
parsed = parse_page(page)
|
|
23
|
+
for item in parsed:
|
|
24
|
+
ready.append(item)
|
|
25
|
+
if parsed:
|
|
26
|
+
ready.pdfpages.append(page.page)
|
|
27
|
+
return ready
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def parse_page(content):
|
|
31
|
+
result = []
|
|
32
|
+
for line in content:
|
|
33
|
+
raw = line.text
|
|
34
|
+
utilo.debug(f'parse: {raw}')
|
|
35
|
+
try:
|
|
36
|
+
short, description = raw.split(maxsplit=1)
|
|
37
|
+
except ValueError:
|
|
38
|
+
if not isexcluded(raw):
|
|
39
|
+
utilo.debug(f'could not parse abbreviation: {raw}')
|
|
40
|
+
continue
|
|
41
|
+
if isexcluded(short) or isexcluded(description):
|
|
42
|
+
utilo.info(f'skip: {short}, {description}')
|
|
43
|
+
continue
|
|
44
|
+
short, description = short.strip(), description.strip()
|
|
45
|
+
parsed = iamraw.Abbreviation(
|
|
46
|
+
short=short,
|
|
47
|
+
description=description,
|
|
48
|
+
)
|
|
49
|
+
utilo.debug(f'parsed: {parsed}')
|
|
50
|
+
result.append(parsed)
|
|
51
|
+
return result
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def isexcluded(item: str) -> bool:
|
|
55
|
+
# TODO: ADD MORE SOPHISTICATED DOUBLE COLUMN CHECKER
|
|
56
|
+
item = item.strip().lower()
|
|
57
|
+
if item in elementae.headline.lookup.HEADLINES:
|
|
58
|
+
return True
|
|
59
|
+
if item in NO_ABBREVIATION:
|
|
60
|
+
return True
|
|
61
|
+
return False
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
NO_ABBREVIATION = utilo.splitlines("""\
|
|
65
|
+
BESCHREIBUNG
|
|
66
|
+
""")
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2019-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
#==============================================================================
|
|
9
|
+
|
|
10
|
+
import utilo
|
|
11
|
+
|
|
12
|
+
import reftable
|
|
13
|
+
|
|
14
|
+
DESCRIPTION = ''
|
|
15
|
+
|
|
16
|
+
WORKPLAN = [
|
|
17
|
+
utilo.create_step(
|
|
18
|
+
'abbrev',
|
|
19
|
+
inputs=[
|
|
20
|
+
utilo.ResultFile(producer='rawmaker', name='text_text'),
|
|
21
|
+
utilo.ResultFile(producer='rawmaker', name='text_positions'),
|
|
22
|
+
utilo.ResultFile(producer='rawmaker', name='oneline_text_text'),
|
|
23
|
+
utilo.ResultFile('rawmaker', name='oneline_text_positions'),
|
|
24
|
+
utilo.ResultFile(producer='groupme', name='footer_footerheader'),
|
|
25
|
+
utilo.ResultFile(producer='rawmaker', name='border_pages'),
|
|
26
|
+
],
|
|
27
|
+
output=('abbrev',),
|
|
28
|
+
),
|
|
29
|
+
utilo.create_step(
|
|
30
|
+
'toc',
|
|
31
|
+
inputs=[
|
|
32
|
+
utilo.ResultFile(producer='rawmaker', name='oneline_text_text'),
|
|
33
|
+
utilo.ResultFile('rawmaker', name='oneline_text_positions'),
|
|
34
|
+
utilo.ResultFile(producer='groupme', name='footer_footerheader'),
|
|
35
|
+
utilo.ResultFile(producer='rawmaker', name='border_pages'),
|
|
36
|
+
],
|
|
37
|
+
output=('toc',),
|
|
38
|
+
),
|
|
39
|
+
utilo.create_step(
|
|
40
|
+
'figure',
|
|
41
|
+
inputs=[
|
|
42
|
+
utilo.ResultFile(producer='rawmaker', name='text_text'),
|
|
43
|
+
utilo.ResultFile(producer='rawmaker', name='text_positions'),
|
|
44
|
+
utilo.ResultFile(producer='rawmaker', name='oneline_text_text'),
|
|
45
|
+
utilo.ResultFile('rawmaker', name='oneline_text_positions'),
|
|
46
|
+
utilo.ResultFile(producer='groupme', name='footer_footerheader'),
|
|
47
|
+
utilo.ResultFile(producer='rawmaker', name='border_pages'),
|
|
48
|
+
],
|
|
49
|
+
output=('figure',),
|
|
50
|
+
),
|
|
51
|
+
utilo.create_step(
|
|
52
|
+
'table',
|
|
53
|
+
inputs=[
|
|
54
|
+
utilo.ResultFile(producer='rawmaker', name='oneline_text_text'),
|
|
55
|
+
utilo.ResultFile('rawmaker', name='oneline_text_positions'),
|
|
56
|
+
utilo.ResultFile(producer='groupme', name='footer_footerheader'),
|
|
57
|
+
utilo.ResultFile(producer='rawmaker', name='border_pages'),
|
|
58
|
+
],
|
|
59
|
+
output=('table',),
|
|
60
|
+
),
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def main():
|
|
65
|
+
utilo.featurepack(
|
|
66
|
+
workplan=WORKPLAN,
|
|
67
|
+
root=reftable.ROOT,
|
|
68
|
+
featurepackage='reftable.feature',
|
|
69
|
+
config=utilo.FeaturePackConfig(
|
|
70
|
+
description=DESCRIPTION,
|
|
71
|
+
multiprocessed=True,
|
|
72
|
+
name=reftable.PROCESS,
|
|
73
|
+
pages=True,
|
|
74
|
+
version=reftable.__version__,
|
|
75
|
+
),
|
|
76
|
+
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2022-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
|
|
10
|
+
import serializeraw
|
|
11
|
+
|
|
12
|
+
import reftable.abbrev
|
|
13
|
+
import reftable.abbrev.parser
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def work(
|
|
17
|
+
text: str,
|
|
18
|
+
textposition: str,
|
|
19
|
+
text_oneline: str,
|
|
20
|
+
textposition_oneline: str,
|
|
21
|
+
headerfooter: str,
|
|
22
|
+
sizeandborder: str,
|
|
23
|
+
pages: tuple = None,
|
|
24
|
+
) -> str:
|
|
25
|
+
data = load_data(
|
|
26
|
+
text,
|
|
27
|
+
textposition,
|
|
28
|
+
text_oneline,
|
|
29
|
+
textposition_oneline,
|
|
30
|
+
headerfooter,
|
|
31
|
+
sizeandborder,
|
|
32
|
+
pages,
|
|
33
|
+
)
|
|
34
|
+
parsed = reftable.abbrev.parser.parse(data)
|
|
35
|
+
# dump result
|
|
36
|
+
dumped = serializeraw.dump_abbreviation_table(parsed)
|
|
37
|
+
return dumped
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def load_data(
|
|
41
|
+
text: str,
|
|
42
|
+
textposition: str,
|
|
43
|
+
text_oneline: str,
|
|
44
|
+
textposition_oneline: str,
|
|
45
|
+
headerfooter: str,
|
|
46
|
+
sizeandborder: str,
|
|
47
|
+
pages: tuple = None,
|
|
48
|
+
) -> reftable.abbrev.AbbreviationData:
|
|
49
|
+
normal = serializeraw.ptcn_fromfile(
|
|
50
|
+
text=text,
|
|
51
|
+
textpositions=textposition,
|
|
52
|
+
sizeandborder=sizeandborder,
|
|
53
|
+
headerfooter=headerfooter,
|
|
54
|
+
pages=pages,
|
|
55
|
+
)
|
|
56
|
+
oneline = serializeraw.ptcn_fromfile(
|
|
57
|
+
text=text_oneline,
|
|
58
|
+
textpositions=textposition_oneline,
|
|
59
|
+
sizeandborder=sizeandborder,
|
|
60
|
+
headerfooter=headerfooter,
|
|
61
|
+
pages=pages,
|
|
62
|
+
)
|
|
63
|
+
data = reftable.abbrev.AbbreviationData(
|
|
64
|
+
normal=normal,
|
|
65
|
+
oneline=oneline,
|
|
66
|
+
)
|
|
67
|
+
return data
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2019-2023 by Helmut Konrad Schewe. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Schewe. Any unauthorized copy,
|
|
6
|
+
# use or distribution is an offensive act against international law and may
|
|
7
|
+
# be prosecuted under federal law. Its content is company confidential.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
"""Table of figures extractor
|
|
10
|
+
==========================
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import serializeraw
|
|
14
|
+
|
|
15
|
+
import reftable.figure.strategy
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def work(
|
|
19
|
+
text: str,
|
|
20
|
+
textpositions: str,
|
|
21
|
+
oneline_text: str,
|
|
22
|
+
oneline_textpositions: str,
|
|
23
|
+
headerfooter: str,
|
|
24
|
+
sizeandborder: str,
|
|
25
|
+
pages: tuple = None,
|
|
26
|
+
) -> str:
|
|
27
|
+
"""Extract table of figures out of `document`.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
text(str): path to load document
|
|
31
|
+
textpositions(str): path to load document textpositions
|
|
32
|
+
oneline_text(str): oneline document
|
|
33
|
+
oneline_textpositions(str): oneline document positions
|
|
34
|
+
headerfooter(str): path with header and footer to determine
|
|
35
|
+
content border.
|
|
36
|
+
sizeandborder(str): path with page sizes and content border
|
|
37
|
+
pages(tuple): tuple of selected pages
|
|
38
|
+
Returns:
|
|
39
|
+
dump of extracted table of content
|
|
40
|
+
"""
|
|
41
|
+
result = reftable.figure.strategy.run(
|
|
42
|
+
text=text,
|
|
43
|
+
textpositions=textpositions,
|
|
44
|
+
oneline_text=oneline_text,
|
|
45
|
+
oneline_textpositions=oneline_textpositions,
|
|
46
|
+
headerfooter=headerfooter,
|
|
47
|
+
sizeandborder=sizeandborder,
|
|
48
|
+
pages=pages,
|
|
49
|
+
)
|
|
50
|
+
dumped = serializeraw.dump_toc(result)
|
|
51
|
+
return dumped
|