decider-chapter 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.
- decider_chapter-1.0.0/PKG-INFO +35 -0
- decider_chapter-1.0.0/README +1 -0
- decider_chapter-1.0.0/chapter/__init__.py +24 -0
- decider_chapter-1.0.0/chapter/cli.py +41 -0
- decider_chapter-1.0.0/chapter/features/__init__.py +8 -0
- decider_chapter-1.0.0/chapter/features/intro.py +49 -0
- decider_chapter-1.0.0/chapter/intro/__init__.py +8 -0
- decider_chapter-1.0.0/chapter/intro/data.py +128 -0
- decider_chapter-1.0.0/chapter/intro/decide.py +59 -0
- decider_chapter-1.0.0/chapter/path.py +14 -0
- decider_chapter-1.0.0/chapter/serialize.py +35 -0
- decider_chapter-1.0.0/chapter/utils.py +61 -0
- decider_chapter-1.0.0/decider_chapter.egg-info/PKG-INFO +35 -0
- decider_chapter-1.0.0/decider_chapter.egg-info/SOURCES.txt +18 -0
- decider_chapter-1.0.0/decider_chapter.egg-info/dependency_links.txt +1 -0
- decider_chapter-1.0.0/decider_chapter.egg-info/entry_points.txt +2 -0
- decider_chapter-1.0.0/decider_chapter.egg-info/requires.txt +20 -0
- decider_chapter-1.0.0/decider_chapter.egg-info/top_level.txt +1 -0
- decider_chapter-1.0.0/pyproject.toml +109 -0
- decider_chapter-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: decider-chapter
|
|
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/iamraw
|
|
7
|
+
Project-URL: Repository, https://github.com/anaticulae/iamraw
|
|
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
|
+
Requires-Dist: germania<2.0.0,>=1.32.2
|
|
14
|
+
Requires-Dist: iamraw<5.0.0,>=4.95.0
|
|
15
|
+
Requires-Dist: utilo<3.0.0,>=2.110.2
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: capita==1.25.3; extra == "dev"
|
|
18
|
+
Requires-Dist: capita_ref==1.0.1; extra == "dev"
|
|
19
|
+
Requires-Dist: gennex==1.1.0; extra == "dev"
|
|
20
|
+
Requires-Dist: groupmes==1.1.0; extra == "dev"
|
|
21
|
+
Requires-Dist: headnote==1.0.3; extra == "dev"
|
|
22
|
+
Requires-Dist: hoverpower==1.7.0; extra == "dev"
|
|
23
|
+
Requires-Dist: ibidem==1.0.2; extra == "dev"
|
|
24
|
+
Requires-Dist: indicibus==1.0.2; extra == "dev"
|
|
25
|
+
Requires-Dist: pagenumber==1.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: rawmaker==2.40.5; extra == "dev"
|
|
27
|
+
Requires-Dist: reftable==1.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: tablero==1.0.1; extra == "dev"
|
|
29
|
+
Requires-Dist: titulum==1.0.2; extra == "dev"
|
|
30
|
+
Requires-Dist: utilotest==1.1.1; extra == "dev"
|
|
31
|
+
Requires-Dist: verbo==1.23.4; extra == "dev"
|
|
32
|
+
Requires-Dist: rawmaker==2.40.5; extra == "dev"
|
|
33
|
+
Requires-Dist: pagenumber==1.0.0; extra == "dev"
|
|
34
|
+
|
|
35
|
+
# chapter
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# chapter
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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
|
+
"""Chapter
|
|
10
|
+
=======
|
|
11
|
+
|
|
12
|
+
The chapter module tries to detect or analyse the meaning of a chapter.
|
|
13
|
+
A main point is to find that requested features are given.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import importlib.metadata
|
|
17
|
+
import os
|
|
18
|
+
|
|
19
|
+
import chapter.path
|
|
20
|
+
|
|
21
|
+
__version__ = importlib.metadata.version('decider-chapter')
|
|
22
|
+
|
|
23
|
+
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
24
|
+
PROCESS = 'decider_chapter'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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 chapter
|
|
13
|
+
|
|
14
|
+
DESCRIPTION = ''
|
|
15
|
+
|
|
16
|
+
WORKPLAN = [
|
|
17
|
+
utilo.create_step(
|
|
18
|
+
'intro',
|
|
19
|
+
inputs=[
|
|
20
|
+
utilo.ResultFile('words', 'sentences_sentences'),
|
|
21
|
+
utilo.ResultFile('headlines', 'result_result'),
|
|
22
|
+
utilo.ResultFile('sections', 'section_result'),
|
|
23
|
+
],
|
|
24
|
+
output=('intro',),
|
|
25
|
+
),
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def main():
|
|
30
|
+
utilo.featurepack(
|
|
31
|
+
workplan=WORKPLAN,
|
|
32
|
+
root=chapter.ROOT,
|
|
33
|
+
featurepackage='chapter.features',
|
|
34
|
+
config=utilo.FeaturePackConfig(
|
|
35
|
+
description=DESCRIPTION,
|
|
36
|
+
multiprocessed=True,
|
|
37
|
+
name=chapter.PROCESS,
|
|
38
|
+
pages=True,
|
|
39
|
+
version=chapter.__version__,
|
|
40
|
+
),
|
|
41
|
+
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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,49 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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 chapter.intro.decide
|
|
13
|
+
import chapter.serialize
|
|
14
|
+
import chapter.utils
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def work(
|
|
18
|
+
sentences: str,
|
|
19
|
+
headlines: str,
|
|
20
|
+
sections: str,
|
|
21
|
+
pages: tuple = None,
|
|
22
|
+
) -> str:
|
|
23
|
+
# load data
|
|
24
|
+
headlines = serializeraw.load_headlines(headlines, pages=pages)
|
|
25
|
+
sentences = serializeraw.load_text(
|
|
26
|
+
sentences,
|
|
27
|
+
headlines=headlines,
|
|
28
|
+
pages=pages,
|
|
29
|
+
)
|
|
30
|
+
sections = serializeraw.load_sections(sections, pages=pages)
|
|
31
|
+
intro = run_intro(sentences, sections)
|
|
32
|
+
# dump
|
|
33
|
+
dumped = chapter.serialize.dump_chapter_introinfo(intro)
|
|
34
|
+
return dumped
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def run_intro(sentences, sections):
|
|
38
|
+
# run algo
|
|
39
|
+
detected = chapter.utils.firstchapter(
|
|
40
|
+
sentences,
|
|
41
|
+
sections,
|
|
42
|
+
)
|
|
43
|
+
if not detected:
|
|
44
|
+
# could not detect firstchapter, content
|
|
45
|
+
return chapter.serialize.ChapterIntroInfo()
|
|
46
|
+
content, firstchapter = detected
|
|
47
|
+
found = chapter.intro.decide.run(content)
|
|
48
|
+
result = chapter.intro.decide.judge(found, firstchapter)
|
|
49
|
+
return result
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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,128 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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 enum
|
|
11
|
+
|
|
12
|
+
import utilo
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class IntroType(enum.IntEnum):
|
|
16
|
+
# Hinführung zum Thema
|
|
17
|
+
START = enum.auto()
|
|
18
|
+
# Gegenstand, Problemstellung und Ziele der Arbeit
|
|
19
|
+
GOAL = enum.auto()
|
|
20
|
+
# Gang der Untersuchung
|
|
21
|
+
METHOD = enum.auto()
|
|
22
|
+
# Abgrenzung der Arbeit
|
|
23
|
+
LIMIT = enum.auto()
|
|
24
|
+
# Aufbau der Arbeit
|
|
25
|
+
STRUCTURE = enum.auto()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
START = utilo.splitlines("""\
|
|
29
|
+
Circa
|
|
30
|
+
Ein Beispiel dafür
|
|
31
|
+
Einleitung
|
|
32
|
+
Kritisch beurteilt wird
|
|
33
|
+
deuten an
|
|
34
|
+
erfreuen sich großer Beliebtheit
|
|
35
|
+
gegenwärtig weite Kreise
|
|
36
|
+
haben gut
|
|
37
|
+
kaum noch wegzudenken
|
|
38
|
+
sondern deuten auch an
|
|
39
|
+
spielt im
|
|
40
|
+
ziehen sie gegenwärtig weite Kreise
|
|
41
|
+
""")
|
|
42
|
+
|
|
43
|
+
GOAL = utilo.splitlines("""\
|
|
44
|
+
Arbeit leiten wird
|
|
45
|
+
Der Schwerpunkt
|
|
46
|
+
Forschungsfragen
|
|
47
|
+
Fragestellung und Zielsetzung
|
|
48
|
+
Welche
|
|
49
|
+
Welche Aspekte
|
|
50
|
+
Wie gestaltet
|
|
51
|
+
Wie oft
|
|
52
|
+
Zentraler Bestandteil
|
|
53
|
+
Ziel
|
|
54
|
+
Ziel der folgenden Ausführungen
|
|
55
|
+
Ziel dieser Arbeit
|
|
56
|
+
folgende Forschungsfragen
|
|
57
|
+
wenig erforschtes Gebiet
|
|
58
|
+
zentrale Fragestellung
|
|
59
|
+
zu entwerfen
|
|
60
|
+
zu identifizieren
|
|
61
|
+
zu implementieren
|
|
62
|
+
""")
|
|
63
|
+
|
|
64
|
+
METHOD = utilo.splitlines("""\
|
|
65
|
+
Auswahlkriterium zur Stichprobenkonstruktion
|
|
66
|
+
Bearbeitung dieser Leitfrage
|
|
67
|
+
Hierfür wurde abgefragt
|
|
68
|
+
Im Zuge
|
|
69
|
+
Quotenauswahl
|
|
70
|
+
Stichprobe
|
|
71
|
+
Stichprobenart
|
|
72
|
+
Stichprobenumfang
|
|
73
|
+
Untersuchungsgebiete
|
|
74
|
+
demographischen Merkmalen
|
|
75
|
+
den Ansätzen
|
|
76
|
+
funktionalen Zugang
|
|
77
|
+
modular und leicht erweiterbar
|
|
78
|
+
repräsentative, standardisierte Kundenbefragung
|
|
79
|
+
soll anhand
|
|
80
|
+
sozioökonomische Daten
|
|
81
|
+
standardisierten Fragebogens
|
|
82
|
+
theoretische Strömungen
|
|
83
|
+
theoretischen Ansätze werden
|
|
84
|
+
verschiedenen Gruppen
|
|
85
|
+
zueinander in Beziehung gesetzt
|
|
86
|
+
""")
|
|
87
|
+
|
|
88
|
+
LIMIT = utilo.splitlines("""\
|
|
89
|
+
Arbeit nicht durchgeführt werden
|
|
90
|
+
Literatur bisher kaum verfolgt
|
|
91
|
+
Selten wird
|
|
92
|
+
Zeitrahmen
|
|
93
|
+
bewusst keinen Beitrag
|
|
94
|
+
festgestellt werden
|
|
95
|
+
kaum Ansätze zu finden
|
|
96
|
+
nicht möglich sein wird
|
|
97
|
+
sondern legt den Fokus
|
|
98
|
+
""")
|
|
99
|
+
|
|
100
|
+
STRUCTURE = utilo.splitlines("""\
|
|
101
|
+
Aufbau der Arbeit
|
|
102
|
+
Kapitel 1
|
|
103
|
+
Kapitel 2
|
|
104
|
+
Kapitel 3
|
|
105
|
+
Kapitel 4
|
|
106
|
+
Kapitel 5
|
|
107
|
+
beschreibt den
|
|
108
|
+
des vierten Teils
|
|
109
|
+
dritten Kapitel
|
|
110
|
+
erste Kapitel
|
|
111
|
+
fünfte Kapitel
|
|
112
|
+
gibt eine Einführung
|
|
113
|
+
gliedert sich in
|
|
114
|
+
in fünf Teile
|
|
115
|
+
stellt die wichtigsten
|
|
116
|
+
vierte Kapitel
|
|
117
|
+
werden Begriffe und Überlegungen
|
|
118
|
+
zweite Kapitel
|
|
119
|
+
zweiten Teil
|
|
120
|
+
""")
|
|
121
|
+
|
|
122
|
+
TODO = [
|
|
123
|
+
(IntroType.START, START),
|
|
124
|
+
(IntroType.GOAL, GOAL),
|
|
125
|
+
(IntroType.METHOD, METHOD),
|
|
126
|
+
(IntroType.LIMIT, LIMIT),
|
|
127
|
+
(IntroType.STRUCTURE, STRUCTURE),
|
|
128
|
+
]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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 germania
|
|
11
|
+
|
|
12
|
+
import chapter.intro.data
|
|
13
|
+
import chapter.serialize
|
|
14
|
+
|
|
15
|
+
FIELDS = 'start goal method limit structure'.split()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def judge(lines, ranges) -> chapter.serialize.ChapterIntroInfo:
|
|
19
|
+
result = chapter.serialize.ChapterIntroInfo(
|
|
20
|
+
pagestart=ranges[0],
|
|
21
|
+
pageend=ranges[1],
|
|
22
|
+
)
|
|
23
|
+
for index, line in enumerate(lines):
|
|
24
|
+
if not line:
|
|
25
|
+
continue
|
|
26
|
+
for ind, name in enumerate(FIELDS):
|
|
27
|
+
if not line[ind]:
|
|
28
|
+
continue
|
|
29
|
+
getattr(result, name).append((index, line[ind]))
|
|
30
|
+
return result
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def run(sentences: list) -> list:
|
|
34
|
+
result = []
|
|
35
|
+
for sentence in sentences:
|
|
36
|
+
if not isinstance(sentence, str):
|
|
37
|
+
# headline
|
|
38
|
+
sentence = sentence.title
|
|
39
|
+
if sentence is None:
|
|
40
|
+
# TODO: SHOULD NOT HAPPEN
|
|
41
|
+
result.append(None)
|
|
42
|
+
continue
|
|
43
|
+
detected = analyse(sentence)
|
|
44
|
+
if not any(detected):
|
|
45
|
+
result.append(None)
|
|
46
|
+
continue
|
|
47
|
+
result.append(detected)
|
|
48
|
+
return result
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def analyse(sentence: str) -> tuple:
|
|
52
|
+
result = []
|
|
53
|
+
for _, tokens in chapter.intro.data.TODO:
|
|
54
|
+
found = germania.searches(
|
|
55
|
+
tokens,
|
|
56
|
+
sentence=sentence,
|
|
57
|
+
)
|
|
58
|
+
result.append(len(found))
|
|
59
|
+
return result
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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
|
+
|
|
13
|
+
def chapter_intro(path: str, prefix: str = '') -> str:
|
|
14
|
+
return utilo.pathconnector(path, 'decider_chapter', 'intro_intro', prefix)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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 dataclasses
|
|
11
|
+
|
|
12
|
+
import utilo
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclasses.dataclass
|
|
16
|
+
class ChapterIntroInfo:
|
|
17
|
+
pagestart: int = None
|
|
18
|
+
pageend: int = None
|
|
19
|
+
start: list = dataclasses.field(default_factory=list)
|
|
20
|
+
goal: list = dataclasses.field(default_factory=list)
|
|
21
|
+
method: list = dataclasses.field(default_factory=list)
|
|
22
|
+
limit: list = dataclasses.field(default_factory=list)
|
|
23
|
+
structure: list = dataclasses.field(default_factory=list)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def dump_chapter_introinfo(intro: ChapterIntroInfo) -> str:
|
|
27
|
+
raw = dataclasses.asdict(intro)
|
|
28
|
+
dumped = utilo.yaml_dump(raw)
|
|
29
|
+
return dumped
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def load_chapter_introinfo(path: str) -> ChapterIntroInfo:
|
|
33
|
+
loaded = utilo.yaml_load(path)
|
|
34
|
+
result = ChapterIntroInfo(**loaded)
|
|
35
|
+
return result
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# C O P Y R I G H T
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2020-2022 by Helmut Konrad Fahrendholz. All rights reserved.
|
|
5
|
+
# This file is property of Helmut Konrad Fahrendholz. 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 contextlib
|
|
11
|
+
|
|
12
|
+
import iamraw
|
|
13
|
+
import utilo
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def mainpart(sections):
|
|
17
|
+
for item in sections.content:
|
|
18
|
+
if not isinstance(item, iamraw.MainPart):
|
|
19
|
+
continue
|
|
20
|
+
return item
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def select_chapter(sections, chapternumber: int = 0):
|
|
25
|
+
assert chapternumber >= 0, f'invalid chapter number: {chapternumber}'
|
|
26
|
+
main = mainpart(sections)
|
|
27
|
+
if not main:
|
|
28
|
+
return None
|
|
29
|
+
chapters = []
|
|
30
|
+
for item in main.content:
|
|
31
|
+
if isinstance(item, iamraw.sections.Chapter):
|
|
32
|
+
chapters.append(item.start)
|
|
33
|
+
continue
|
|
34
|
+
if len(main.content) > 1:
|
|
35
|
+
chapters.append(main.content[-1].end)
|
|
36
|
+
# select chapter by chapternumber
|
|
37
|
+
with contextlib.suppress(IndexError):
|
|
38
|
+
return chapters[chapternumber], chapters[chapternumber + 1]
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def firstchapter(words, sections):
|
|
43
|
+
first = select_chapter(
|
|
44
|
+
sections,
|
|
45
|
+
chapternumber=0,
|
|
46
|
+
)
|
|
47
|
+
if first is None:
|
|
48
|
+
return None
|
|
49
|
+
start, end = first
|
|
50
|
+
selected = [
|
|
51
|
+
utilo.select_page(words, page) for page in utilo.rtuple(start, end)
|
|
52
|
+
]
|
|
53
|
+
result = []
|
|
54
|
+
for page in selected:
|
|
55
|
+
if not page:
|
|
56
|
+
# empty page?
|
|
57
|
+
continue
|
|
58
|
+
for section in page.content:
|
|
59
|
+
result.append(section.headline)
|
|
60
|
+
result.extend(section.content)
|
|
61
|
+
return result, first
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: decider-chapter
|
|
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/iamraw
|
|
7
|
+
Project-URL: Repository, https://github.com/anaticulae/iamraw
|
|
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
|
+
Requires-Dist: germania<2.0.0,>=1.32.2
|
|
14
|
+
Requires-Dist: iamraw<5.0.0,>=4.95.0
|
|
15
|
+
Requires-Dist: utilo<3.0.0,>=2.110.2
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: capita==1.25.3; extra == "dev"
|
|
18
|
+
Requires-Dist: capita_ref==1.0.1; extra == "dev"
|
|
19
|
+
Requires-Dist: gennex==1.1.0; extra == "dev"
|
|
20
|
+
Requires-Dist: groupmes==1.1.0; extra == "dev"
|
|
21
|
+
Requires-Dist: headnote==1.0.3; extra == "dev"
|
|
22
|
+
Requires-Dist: hoverpower==1.7.0; extra == "dev"
|
|
23
|
+
Requires-Dist: ibidem==1.0.2; extra == "dev"
|
|
24
|
+
Requires-Dist: indicibus==1.0.2; extra == "dev"
|
|
25
|
+
Requires-Dist: pagenumber==1.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: rawmaker==2.40.5; extra == "dev"
|
|
27
|
+
Requires-Dist: reftable==1.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: tablero==1.0.1; extra == "dev"
|
|
29
|
+
Requires-Dist: titulum==1.0.2; extra == "dev"
|
|
30
|
+
Requires-Dist: utilotest==1.1.1; extra == "dev"
|
|
31
|
+
Requires-Dist: verbo==1.23.4; extra == "dev"
|
|
32
|
+
Requires-Dist: rawmaker==2.40.5; extra == "dev"
|
|
33
|
+
Requires-Dist: pagenumber==1.0.0; extra == "dev"
|
|
34
|
+
|
|
35
|
+
# chapter
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
README
|
|
2
|
+
pyproject.toml
|
|
3
|
+
chapter/__init__.py
|
|
4
|
+
chapter/cli.py
|
|
5
|
+
chapter/path.py
|
|
6
|
+
chapter/serialize.py
|
|
7
|
+
chapter/utils.py
|
|
8
|
+
chapter/features/__init__.py
|
|
9
|
+
chapter/features/intro.py
|
|
10
|
+
chapter/intro/__init__.py
|
|
11
|
+
chapter/intro/data.py
|
|
12
|
+
chapter/intro/decide.py
|
|
13
|
+
decider_chapter.egg-info/PKG-INFO
|
|
14
|
+
decider_chapter.egg-info/SOURCES.txt
|
|
15
|
+
decider_chapter.egg-info/dependency_links.txt
|
|
16
|
+
decider_chapter.egg-info/entry_points.txt
|
|
17
|
+
decider_chapter.egg-info/requires.txt
|
|
18
|
+
decider_chapter.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
germania<2.0.0,>=1.32.2
|
|
2
|
+
iamraw<5.0.0,>=4.95.0
|
|
3
|
+
utilo<3.0.0,>=2.110.2
|
|
4
|
+
|
|
5
|
+
[dev]
|
|
6
|
+
capita==1.25.3
|
|
7
|
+
capita_ref==1.0.1
|
|
8
|
+
gennex==1.1.0
|
|
9
|
+
groupmes==1.1.0
|
|
10
|
+
headnote==1.0.3
|
|
11
|
+
hoverpower==1.7.0
|
|
12
|
+
ibidem==1.0.2
|
|
13
|
+
indicibus==1.0.2
|
|
14
|
+
pagenumber==1.0.0
|
|
15
|
+
rawmaker==2.40.5
|
|
16
|
+
reftable==1.0.0
|
|
17
|
+
tablero==1.0.1
|
|
18
|
+
titulum==1.0.2
|
|
19
|
+
utilotest==1.1.1
|
|
20
|
+
verbo==1.23.4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chapter
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools>=82.0.1",
|
|
4
|
+
"wheel>=0.47.0",
|
|
5
|
+
]
|
|
6
|
+
build-backend = "setuptools.build_meta"
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "decider-chapter"
|
|
10
|
+
version = "1.0.0"
|
|
11
|
+
description = ""
|
|
12
|
+
requires-python = ">=3.12"
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Helmut Konrad Schewe", email = "helmutus@outlook.com" },
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"germania>=1.32.2,<2.0.0",
|
|
18
|
+
"iamraw>=4.95.0,<5.0.0",
|
|
19
|
+
"utilo>=2.110.2,<3.0.0",
|
|
20
|
+
]
|
|
21
|
+
keywords = []
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
]
|
|
27
|
+
license = "MIT"
|
|
28
|
+
license-files = [
|
|
29
|
+
"LICENSE",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.readme]
|
|
33
|
+
file = "README"
|
|
34
|
+
content-type = "text/markdown"
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
dev = [
|
|
38
|
+
"capita==1.25.3",
|
|
39
|
+
"capita_ref==1.0.1",
|
|
40
|
+
"gennex==1.1.0",
|
|
41
|
+
"groupmes==1.1.0",
|
|
42
|
+
"headnote==1.0.3",
|
|
43
|
+
"hoverpower==1.7.0",
|
|
44
|
+
"ibidem==1.0.2",
|
|
45
|
+
"indicibus==1.0.2",
|
|
46
|
+
"pagenumber==1.0.0",
|
|
47
|
+
"rawmaker==2.40.5",
|
|
48
|
+
"reftable==1.0.0",
|
|
49
|
+
"tablero==1.0.1",
|
|
50
|
+
"titulum==1.0.2",
|
|
51
|
+
"utilotest==1.1.1",
|
|
52
|
+
"verbo==1.23.4",
|
|
53
|
+
"rawmaker==2.40.5",
|
|
54
|
+
"pagenumber==1.0.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.scripts]
|
|
58
|
+
decider_chapter = "chapter.cli:main"
|
|
59
|
+
|
|
60
|
+
[project.urls]
|
|
61
|
+
Homepage = "https://github.com/anaticulae/iamraw"
|
|
62
|
+
Repository = "https://github.com/anaticulae/iamraw"
|
|
63
|
+
|
|
64
|
+
[tool.semantic_release]
|
|
65
|
+
version_toml = [
|
|
66
|
+
"pyproject.toml:project.version",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.semantic_release.changelog]
|
|
70
|
+
mode = "init"
|
|
71
|
+
output_format = "md"
|
|
72
|
+
|
|
73
|
+
[tool.semantic_release.changelog.default_templates]
|
|
74
|
+
changelog_file = "CHANGELOG"
|
|
75
|
+
|
|
76
|
+
[tool.semantic_release.commit_parser_options]
|
|
77
|
+
patch_tags = [
|
|
78
|
+
"build",
|
|
79
|
+
"chore",
|
|
80
|
+
"ci",
|
|
81
|
+
"deps",
|
|
82
|
+
"docs",
|
|
83
|
+
"fix",
|
|
84
|
+
"perf",
|
|
85
|
+
"refactor",
|
|
86
|
+
"style",
|
|
87
|
+
"test",
|
|
88
|
+
]
|
|
89
|
+
minor_tags = [
|
|
90
|
+
"feat",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[tool.setuptools.packages.find]
|
|
94
|
+
where = [
|
|
95
|
+
".",
|
|
96
|
+
]
|
|
97
|
+
include = [
|
|
98
|
+
"chapter",
|
|
99
|
+
"chapter.features",
|
|
100
|
+
"chapter.intro",
|
|
101
|
+
]
|
|
102
|
+
exclude = [
|
|
103
|
+
"tests*",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[tool.hoverpower]
|
|
107
|
+
packages = [
|
|
108
|
+
"MASTER",
|
|
109
|
+
]
|