decider-con 1.0.0__py3-none-any.whl

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.
Files changed (45) hide show
  1. chapter_/__init__.py +15 -0
  2. chapter_/cli.py +50 -0
  3. chapter_/features/__init__.py +8 -0
  4. chapter_/features/intro.py +71 -0
  5. chapter_/path.py +14 -0
  6. decider_con/__init__.py +16 -0
  7. decider_con-1.0.0.dist-info/METADATA +30 -0
  8. decider_con-1.0.0.dist-info/RECORD +45 -0
  9. decider_con-1.0.0.dist-info/WHEEL +5 -0
  10. decider_con-1.0.0.dist-info/entry_points.txt +4 -0
  11. decider_con-1.0.0.dist-info/top_level.txt +4 -0
  12. smarty_/__init__.py +22 -0
  13. smarty_/cli.py +55 -0
  14. smarty_/driver.py +97 -0
  15. smarty_/features/__init__.py +8 -0
  16. smarty_/features/badwords.py +126 -0
  17. smarty_/features/spelling.py +82 -0
  18. smarty_/path.py +30 -0
  19. smarty_/utils.py +18 -0
  20. textflow_/__init__.py +22 -0
  21. textflow_/__patch__.py +21 -0
  22. textflow_/cli.py +132 -0
  23. textflow_/docref/__init__.py +8 -0
  24. textflow_/docref/basic.py +107 -0
  25. textflow_/docref/matches.py +193 -0
  26. textflow_/docref/style.py +71 -0
  27. textflow_/features/__init__.py +166 -0
  28. textflow_/features/abbrev.py +107 -0
  29. textflow_/features/character.py +460 -0
  30. textflow_/features/docref.py +69 -0
  31. textflow_/features/lineending.py +260 -0
  32. textflow_/features/paragraph.py +118 -0
  33. textflow_/features/physical.py +109 -0
  34. textflow_/features/quotation.py +169 -0
  35. textflow_/features/startend.py +237 -0
  36. textflow_/features/writing.py +263 -0
  37. textflow_/path.py +75 -0
  38. textflow_/startend/__init__.py +8 -0
  39. textflow_/startend/hurenkind.py +67 -0
  40. textflow_/utils.py +100 -0
  41. textflow_/writing/__init__.py +8 -0
  42. textflow_/writing/complexity.py +21 -0
  43. textflow_/writing/perspective.py +62 -0
  44. textflow_/writing/statistics.py +64 -0
  45. textflow_/writing/utils.py +46 -0
chapter_/__init__.py ADDED
@@ -0,0 +1,15 @@
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 decider_con
11
+
12
+ __version__ = decider_con.__version__
13
+
14
+ PROCESS = 'chapter_'
15
+ ROOT = decider_con.ROOT
chapter_/cli.py ADDED
@@ -0,0 +1,50 @@
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 protoerror
11
+ import utilo
12
+
13
+ import chapter_
14
+ import chapter_.path
15
+
16
+ DESCRIPTION = ''
17
+
18
+ WORKPLAN = [
19
+ utilo.create_step(
20
+ 'intro',
21
+ inputs=[
22
+ utilo.ResultFile('chapter', 'intro_intro'),
23
+ ],
24
+ output=protoerror.ResultDefault,
25
+ ),
26
+ ]
27
+
28
+
29
+ def main():
30
+ hook = protoerror.integrate(
31
+ root=chapter_.ROOT,
32
+ features='chapter_.features',
33
+ )
34
+ docinfo = protoerror.integrate_docinfo()
35
+ utilo.featurepack(
36
+ workplan=WORKPLAN,
37
+ root=chapter_.ROOT,
38
+ featurepackage='chapter_.features',
39
+ config=utilo.FeaturePackConfig(
40
+ cli_hook=[
41
+ docinfo,
42
+ hook,
43
+ ],
44
+ description=DESCRIPTION,
45
+ multiprocessed=True,
46
+ name=chapter_.PROCESS,
47
+ pages=True,
48
+ version=chapter_.__version__,
49
+ ),
50
+ )
@@ -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,71 @@
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 functools
11
+
12
+ import chapter.serialize
13
+ import configos
14
+ import iamraw
15
+ import protoerror
16
+
17
+
18
+ def work(introx: str, docinfo: iamraw.DocInfo) -> protoerror.ResultType:
19
+ intro = chapter.serialize.load_chapter_introinfo(introx)
20
+ driver = protoerror.driver(intro=intro)
21
+ user, developer = protoerror.run(
22
+ __name__,
23
+ driver=driver,
24
+ document=docinfo,
25
+ )
26
+ return user, developer
27
+
28
+
29
+ SOLUTION_6500 = """\
30
+ Einleitung unvollständig
31
+
32
+ Überprüfen Sie die Einleitung und achten darauf dass der Bereich: \
33
+ **{{topic}}** ausreichend dargestellt ist.
34
+
35
+ Siehe optimaler Aufbau:
36
+ {aufbau_gliederung/kapitel1}
37
+
38
+ TODO: ADD AI-USED HINT
39
+ """
40
+
41
+ TOKEN_OCCURRENCE_MIN = configos.HV_INT_PLUS(default=3)
42
+
43
+
44
+ @protoerror.german # TODO REMOVE LATER
45
+ @protoerror.nodiss
46
+ @protoerror.nobook
47
+ @protoerror.nosmall
48
+ def check_6500_intro_complete(linter: callable, driver):
49
+ intro = driver.intro
50
+ if driver.intro.pagestart is None:
51
+ protoerror.skip_method('no intro loaded')
52
+ return
53
+ # 'start', 'goal', 'method', 'limit', 'structure'
54
+ start = len(intro.start) >= TOKEN_OCCURRENCE_MIN
55
+ goal = len(intro.goal) >= TOKEN_OCCURRENCE_MIN
56
+ method = len(intro.method) >= TOKEN_OCCURRENCE_MIN
57
+ limit = len(intro.limit) >= TOKEN_OCCURRENCE_MIN
58
+ structure = len(intro.structure) >= TOKEN_OCCURRENCE_MIN
59
+
60
+ location = iamraw.Location.from_page(page=driver.intro.pagestart)
61
+ linter = functools.partial(linter, location=location)
62
+ if not start:
63
+ linter(topic='Hinführung zum Thema')
64
+ if not goal:
65
+ linter(topic='Ziel der Arbeit')
66
+ if not method:
67
+ linter(topic='Beschreibung der Methodik')
68
+ if not limit:
69
+ linter(topic='Abgrenzung der Arbeit')
70
+ if not structure:
71
+ linter(topic='Aufbau der Arbeit')
chapter_/path.py ADDED
@@ -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, 'chapter_', 'intro_user', prefix)
@@ -0,0 +1,16 @@
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 importlib.metadata
11
+ import os
12
+
13
+ __version__ = importlib.metadata.version('decider-con')
14
+
15
+ ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
16
+ PROCESS = 'decider_con'
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.4
2
+ Name: decider-con
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/decider-con
7
+ Project-URL: Repository, https://github.com/anaticulae/decider-con
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: callidus<2.0.0,>=1.7.1
14
+ Requires-Dist: configos<2.0.0,>=1.0.4
15
+ Requires-Dist: decider_chapter<2.0.0,>=1.0.1
16
+ Requires-Dist: germania<2.0.0,>=1.32.2
17
+ Requires-Dist: iamraw<5.0.0,>=4.95.0
18
+ Requires-Dist: konradus<2.0.0,>=1.0.1
19
+ Requires-Dist: protoerror<4.0.0,>=3.20.4
20
+ Requires-Dist: texes<2.0.0,>=1.0.1
21
+ Requires-Dist: utilo<3.0.0,>=2.111.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: capita==1.25.3; extra == "dev"
24
+ Requires-Dist: capita_ref==1.0.1; extra == "dev"
25
+ Requires-Dist: gennex==1.1.0; extra == "dev"
26
+ Requires-Dist: hoverpower==1.7.0; extra == "dev"
27
+ Requires-Dist: utilotest==1.1.1; extra == "dev"
28
+ Requires-Dist: writers<2.0.0,>=1.7.1; extra == "dev"
29
+
30
+ # decider_con
@@ -0,0 +1,45 @@
1
+ chapter_/__init__.py,sha256=7XYzznJB34PsetYIjLu_1dZiug8OcAA73KMhQbw6d5A,667
2
+ chapter_/cli.py,sha256=SvoNWQHvPSQjrXFlie32vEeO6eJ6ujjPpItvx7kPU_g,1437
3
+ chapter_/path.py,sha256=HMQvFynR8zUm6L9KbkfsjTZS1sdI_oyqWISHC6HtRg0,705
4
+ chapter_/features/__init__.py,sha256=vLnBpo9EL5pN0mL2JD2lvg_6-4dWjykc4o9GRKerxBo,562
5
+ chapter_/features/intro.py,sha256=HW8eM00sOjUJz7kfHWYpVswfUvKqifMvPe4LlU8wyrg,2333
6
+ decider_con/__init__.py,sha256=MalzxSpu7dzyzZmIst64Qqbs00TB6_WRpRzsUUPw50s,751
7
+ smarty_/__init__.py,sha256=Bkqfqh5u4ryecB2XFa2TfUIrpJrJrCjua-_YM3H01Mg,756
8
+ smarty_/cli.py,sha256=B-vL30rPWjQJzheBuGdJ_4Khe3VzfqsonKhGAtXiAJo,1785
9
+ smarty_/driver.py,sha256=PoJqqD-vo_8Yc_EH8uDb6DTNf8M-D7kAlQJN0H1-qj8,2727
10
+ smarty_/path.py,sha256=Tdzohi17eenlZgcJWF984eKRLv8Nkw7asmrx7utxCX0,932
11
+ smarty_/utils.py,sha256=1y-lZWX6wT_1kFLjmPS58wBYIZp9nHYpSxi1TPBMwFE,746
12
+ smarty_/features/__init__.py,sha256=vLnBpo9EL5pN0mL2JD2lvg_6-4dWjykc4o9GRKerxBo,562
13
+ smarty_/features/badwords.py,sha256=M8qYhbCVpsHELlAnjUHhAefyLsoG-vCIUBtzw2UHsnc,3436
14
+ smarty_/features/spelling.py,sha256=CoBa0HWgS3W9El9PaoE4p-sGVyfC2NQ9FHrO_D1M6yM,2486
15
+ textflow_/__init__.py,sha256=tBrFVDj5Dckag1U5Uygebprfhx6UNilA5qS7zaG4iuU,767
16
+ textflow_/__patch__.py,sha256=d0OCZ2VBmiYZrDmb5bsI-TqQIhEfnB3AMqaxOMG5ckE,833
17
+ textflow_/cli.py,sha256=MpzF-54lgswR5nFUTmmEN5v--lUGFV6zBaj7G8sYvRg,4590
18
+ textflow_/path.py,sha256=Cm8Wrk-6C3HjKa9aimNPrAjzlMY5Qx7z6mWnwCRw340,1852
19
+ textflow_/utils.py,sha256=wkPqT-hpAZeEk4eseg2s7ZlUknjwNB7TTgowY-BHm8g,3139
20
+ textflow_/docref/__init__.py,sha256=dVYvlvRlZ0rHCcANE7tmJlIszk87-btm9-YiRm0jS1U,557
21
+ textflow_/docref/basic.py,sha256=T2lipI4d2PSutrDfotmbewCNDUurWAvjS7FIFWOc9ZI,3144
22
+ textflow_/docref/matches.py,sha256=19S51XQk-43j_pQ7sSj7x2VkXmyZhbErFOH_L5dCRx8,6502
23
+ textflow_/docref/style.py,sha256=_drJLoNHH1Yh8VSbY05kaEGscfEZZf3Se6fcyZ0sDA8,2288
24
+ textflow_/features/__init__.py,sha256=1bem5ehbLLLAtJXgxvFyoUGkTk6w15Knt-vRJo7ZyvE,5275
25
+ textflow_/features/abbrev.py,sha256=wJfp6X2M59KriJPc_XpiMcaK064FGxmS7CeyB2ARDPY,3411
26
+ textflow_/features/character.py,sha256=fsvuNKlYPzGocp3zgmorb18bEm9u4ZjDarq0TRuLS9A,11581
27
+ textflow_/features/docref.py,sha256=sC2pYeZN5iAZG_idL1z09xd7q6KP2CRUmh1JNhI9DpM,2162
28
+ textflow_/features/lineending.py,sha256=tA97j49TIa9h4E8LwchmKgNg5Wbf0MbU5lqoJb2JcUE,7356
29
+ textflow_/features/paragraph.py,sha256=mo0snD75M5jm5488HLcXbavjz1O1WRPg0HErBLRj3hY,3479
30
+ textflow_/features/physical.py,sha256=N0Db6p54gx9v0Uibvi8vkDbWwL6PDik0KWo7ElRQJ1A,3115
31
+ textflow_/features/quotation.py,sha256=gAlG7OPtJnMLgQOF6JtoV093YaxHz-wYITPEZ3Z_8UI,5005
32
+ textflow_/features/startend.py,sha256=KVpIotO4Mawvt_FcXHOeKdW1Hm1sZDvnA_dGm6aXcqw,6714
33
+ textflow_/features/writing.py,sha256=V9JMrG0jKYyUr55nByADGkOy_oVjFEqz0W0HIEz5QOQ,7339
34
+ textflow_/startend/__init__.py,sha256=dVYvlvRlZ0rHCcANE7tmJlIszk87-btm9-YiRm0jS1U,557
35
+ textflow_/startend/hurenkind.py,sha256=3xCjikrwgmz09ckrQDb3yLqF1rHIq4qovTRJBw4IpDA,2644
36
+ textflow_/writing/__init__.py,sha256=Mihnaujf_1gC-n4BtXqmZFRMDK0hho-sm9r0aBmMdYI,562
37
+ textflow_/writing/complexity.py,sha256=oYXwQN1VZiWLK6w54J9QDFS55Kzqb6C-V8-Sgpki5B8,884
38
+ textflow_/writing/perspective.py,sha256=jTwYJG1qintlHik9C_mXvxVRzJ9vSZ3dH_EtcqOxaUY,2088
39
+ textflow_/writing/statistics.py,sha256=HNKzPbKGSi_oSrueVZwwKCahYK5T9BP-JL3wO02vjNU,2004
40
+ textflow_/writing/utils.py,sha256=qjfQSkdkdgxCYIv25um5pFnXb2vLFH1IzSsg8j6GdJQ,1582
41
+ decider_con-1.0.0.dist-info/METADATA,sha256=xCNikertoVvCb0ZKQbGCCnVvkShG7ipOoDcezbjs174,1159
42
+ decider_con-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
43
+ decider_con-1.0.0.dist-info/entry_points.txt,sha256=ngHrr645QFLtxcZ9omYgg445xC9SuOCBiXs6hgEJeR0,102
44
+ decider_con-1.0.0.dist-info/top_level.txt,sha256=WtgwzHfC4nZAmuZ-4tPZqAP2zkwoSg3xr6d1JlL2LOg,39
45
+ decider_con-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ chapter = chapter_.cli:main
3
+ smarty = smarty_.cli:main
4
+ textflow = textflow_.cli:main
@@ -0,0 +1,4 @@
1
+ chapter_
2
+ decider_con
3
+ smarty_
4
+ textflow_
smarty_/__init__.py ADDED
@@ -0,0 +1,22 @@
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 configos
11
+
12
+ import decider_con
13
+ import smarty_.path
14
+
15
+ ROOT = decider_con.ROOT
16
+
17
+ __version__ = decider_con.__version__
18
+
19
+ PACKAGE = 'smarty_'
20
+ PROCESS = 'smarty_'
21
+
22
+ configos.cloud_lookup(PROCESS)
smarty_/cli.py ADDED
@@ -0,0 +1,55 @@
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 protoerror
11
+ import utilo
12
+
13
+ import smarty_
14
+
15
+ DESCRIPTION = ''
16
+
17
+ WORKPLAN = [
18
+ utilo.create_step(
19
+ 'badwords',
20
+ inputs=[
21
+ utilo.ResultFile('smarty', 'avoid_avoid'),
22
+ utilo.ResultFile('smarty', 'improvement_improvement'),
23
+ utilo.ResultFile('smarty', 'phrases_phrases'),
24
+ utilo.ResultFile('smarty', 'pleonasma_pleonasma'),
25
+ utilo.ResultFile('smarty', 'reduce_reduce'),
26
+ ],
27
+ output=protoerror.ResultDefault,
28
+ ),
29
+ utilo.create_step(
30
+ 'spelling',
31
+ inputs=[
32
+ utilo.ResultFile('smarty', 'spelling_hyphen'),
33
+ utilo.ResultFile('smarty', 'spelling_guess'),
34
+ ],
35
+ output=protoerror.ResultDefault,
36
+ ),
37
+ ]
38
+
39
+
40
+ def main():
41
+ root, features = smarty_.ROOT, 'smarty_.features'
42
+ hook = protoerror.integrate(root=root, features=features)
43
+ utilo.featurepack(
44
+ workplan=WORKPLAN,
45
+ featurepackage=features,
46
+ root=root,
47
+ config=utilo.FeaturePackConfig(
48
+ description=DESCRIPTION,
49
+ cli_hook=hook,
50
+ multiprocessed=True,
51
+ name=smarty_.PROCESS,
52
+ pages=True,
53
+ version=smarty_.__version__,
54
+ ),
55
+ )
smarty_/driver.py ADDED
@@ -0,0 +1,97 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2021-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 collections
11
+
12
+ import protoerror
13
+ import serializeraw
14
+ import utilo
15
+
16
+
17
+ def create(
18
+ avoid: str = None,
19
+ improvement: str = None,
20
+ phrases: str = None,
21
+ pleonasma: str = None,
22
+ reduce: str = None,
23
+ pages: tuple = None,
24
+ ):
25
+ # prepare findings
26
+ avoid = load_textadvice(avoid, pages=pages)
27
+ improvement = load_textadvice(improvement, pages=pages)
28
+ phrases = load_textadvice(phrases, pages=pages)
29
+ pleonasma = load_textadvice(pleonasma, pages=pages)
30
+ reduce = load_textadvice(reduce, pages=pages)
31
+ # driver
32
+ driver = protoerror.driver(
33
+ avoid=avoid,
34
+ improvement=improvement,
35
+ phrases=phrases,
36
+ pleonasma=pleonasma,
37
+ reduce=reduce,
38
+ )
39
+ return driver
40
+
41
+
42
+ def load_textadvice(path: str, pages: tuple = None):
43
+ if not utilo.exists(path):
44
+ return None
45
+ result = serializeraw.load_textadvices(path, pages=pages)
46
+ return result
47
+
48
+
49
+ def create_spelling(hyphen: str, guess: str, pages: tuple):
50
+ hyphen = load_textadvice(hyphen, pages)
51
+ if not hyphen:
52
+ hyphen = []
53
+ guess = load_textadvice(guess, pages)
54
+ if not guess:
55
+ guess = []
56
+ result = protoerror.driver(
57
+ hyphen=hyphen,
58
+ guess=guess,
59
+ )
60
+ return result
61
+
62
+
63
+ class TokenInside:
64
+ """\
65
+ >>> ti = TokenInside()
66
+ >>> ti.add(5,4,3)
67
+ >>> ti.add(6,2,6)
68
+ >>> ti.contains(6,2,6)
69
+ True
70
+ >>> ti.contains(0,2,6)
71
+ False
72
+ """
73
+
74
+ def __init__(self):
75
+ self.pages = collections.defaultdict(dict)
76
+
77
+ def add(self, page, sentence, token):
78
+ try:
79
+ self.pages[page][sentence].add(token)
80
+ except KeyError:
81
+ self.pages[page][sentence] = {token}
82
+
83
+ def contains(self, page, sentence, token) -> bool:
84
+ try:
85
+ return token in self.pages[page][sentence]
86
+ except KeyError:
87
+ return False
88
+
89
+
90
+ def create_tokeninside(hyphens) -> TokenInside:
91
+ overlapping = TokenInside()
92
+ for hyphen in hyphens:
93
+ docref = hyphen.docref
94
+ for item in docref.marked:
95
+ for token in utilo.rlist(*item):
96
+ overlapping.add(docref.page, docref.sentence, token)
97
+ return overlapping
@@ -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,126 @@
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 protoerror
11
+
12
+ import smarty_.driver
13
+ import smarty_.utils
14
+
15
+
16
+ def work(
17
+ avoid: str,
18
+ improvement: str,
19
+ phrases: str,
20
+ pleonasma: str,
21
+ reduce: str,
22
+ pages: tuple = None,
23
+ ) -> tuple[str, str]:
24
+ driver = smarty_.driver.create(
25
+ avoid,
26
+ improvement,
27
+ phrases,
28
+ pleonasma,
29
+ reduce,
30
+ pages=pages,
31
+ )
32
+ result = protoerror.run(
33
+ modulename=__name__,
34
+ driver=driver,
35
+ )
36
+ return result
37
+
38
+
39
+ SOLUTION_W8100 = """\
40
+ Umgangssprache erkannt
41
+
42
+ Vermeiden Sie **{{phrase}}** und ersetzen Sie diese durch eine \
43
+ förmlichere Formulierung.
44
+
45
+ {text/stilkunde/woerter/wortwahl}
46
+ """
47
+
48
+
49
+ def check_8100_non_formal_speach(linter: callable, driver):
50
+ for error in driver.phrases:
51
+ location = smarty_.utils.create_location(error)
52
+ better = f'({error.replacement})' if error.replacement else ''
53
+ linter(location=location, phrase=error.raw, better=better)
54
+
55
+
56
+ SOLUTION_W8105 = """\
57
+ Pleonasma erkannt
58
+
59
+ Vermeiden Sie **{{phrase}}** und reduzieren Sie diesen auf das \
60
+ Wesentliche **{{better}}**.
61
+
62
+ {text/stilkunde/woerter/pleonasmen}
63
+ """
64
+
65
+
66
+ def check_8105_pleonasms_detected(linter: callable, driver):
67
+ for error in driver.pleonasma:
68
+ location = smarty_.utils.create_location(error)
69
+ better = f'({error.replacement})' if error.replacement else ''
70
+ linter(location=location, phrase=error.raw, better=better)
71
+
72
+
73
+ SOLUTION_W8110 = """\
74
+ Unnötige Vorsilbe
75
+
76
+ Reduzieren Sie **{{phrase}}** indem Sie die unnötige Vorsilbe {{better}} \
77
+ entfernen.
78
+
79
+ TODO
80
+ """
81
+
82
+
83
+ def check_8110_not_required_prefix(linter: callable, driver):
84
+ for error in driver.reduce:
85
+ location = smarty_.utils.create_location(error)
86
+ better = f'({error.replacement})' if error.replacement else ''
87
+ linter(location=location, phrase=error.raw, better=better)
88
+
89
+
90
+ SOLUTION_W8115 = """\
91
+ Ungenaue Formulierung erkannt
92
+
93
+ Die Formulierung **{{phrase}}** ist sehr unkonret. Besser ist **{{better}}**. \
94
+ {{hint}}
95
+ """
96
+
97
+
98
+ def check_8115_required_improvement(linter: callable, driver):
99
+ for error in driver.improvement:
100
+ location = smarty_.utils.create_location(error)
101
+ better = f'({error.replacement})' if error.replacement else '???'
102
+ hint = f'({error.hint})' if error.hint else ''
103
+ linter(
104
+ location=location,
105
+ phrase=error.raw,
106
+ better=better,
107
+ hint=hint,
108
+ )
109
+
110
+
111
+ SOLUTION_W8120 = """\
112
+ Adjektiv verbessern
113
+
114
+ Die Formulierung **{{phrase}}** ist sehr unkonret. Besser ist **{{better}}**.
115
+ """
116
+
117
+
118
+ def check_8120_better_adjective(linter: callable, driver):
119
+ for error in driver.avoid:
120
+ location = smarty_.utils.create_location(error)
121
+ better = f'({error.replacement})' if error.replacement else '???'
122
+ linter(
123
+ location=location,
124
+ phrase=error.raw,
125
+ better=better,
126
+ )
@@ -0,0 +1,82 @@
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
+ import protoerror
12
+
13
+ import smarty_.driver
14
+ import smarty_.utils
15
+
16
+
17
+ def work(hyphen: str, guess: str, pages: tuple = None) -> protoerror.ResultType:
18
+ driver = smarty_.driver.create_spelling(
19
+ hyphen,
20
+ guess,
21
+ pages=pages,
22
+ )
23
+ result = protoerror.run(
24
+ modulename=__name__,
25
+ driver=driver,
26
+ )
27
+ return result
28
+
29
+
30
+ SOLUTION_8200 = """\
31
+ Wortverbindung uneindeutig
32
+
33
+ **{{rawword}}** unterscheidet sich in der Schreibweise von anderen im \
34
+ Dokument gefundenen, überprüfen Sie ob ein Bindestrich notwendig ist, \
35
+ oder korrigieren Sie die anderen Schreibweisen.
36
+ """
37
+
38
+
39
+ def check_8200_hyphen_missing(linter: callable, driver):
40
+ for error in driver.hyphen:
41
+ converted = [germania.token_plain(item) for item in error.docref.raw]
42
+ rawword = '; '.join(converted)
43
+ location = smarty_.utils.create_location(error)
44
+ linter(
45
+ rawword=rawword,
46
+ location=location,
47
+ )
48
+
49
+
50
+ SOLUTION_8205 = """\
51
+ Wortverbindung empfohlen
52
+
53
+ **{{rawword}}** überlegen Sie sich ob Bindestriche hier notwendig sind.
54
+
55
+ TODO: SIEHE DUDEN
56
+ """
57
+
58
+
59
+ def check_8205_try_hyphen(linter: callable, driver):
60
+ inside = smarty_.driver.create_tokeninside(driver.hyphen)
61
+ for error in driver.guess:
62
+ docref = error.docref
63
+ dones = [
64
+ any(
65
+ inside.contains(docref.page, docref.sentence, token)
66
+ for token in tokens)
67
+ for tokens in docref.marked
68
+ ]
69
+ converted = [
70
+ germania.token_plain(item)
71
+ for item, skip in zip(error.docref.raw, dones)
72
+ if not skip
73
+ ]
74
+ if not converted:
75
+ # all words are already markes as hyphen error
76
+ continue
77
+ rawword = '; '.join(converted)
78
+ location = smarty_.utils.create_location(error)
79
+ linter(
80
+ rawword=rawword,
81
+ location=location,
82
+ )