Skip to content

Commit bf7ec20

Browse files
committed
update satzbau
- add toying german sentences recognition
1 parent 42f4d8d commit bf7ec20

21 files changed

+7270
-8
lines changed

src/client.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ def ensure_package(
173173
# \brief check the requiere import modules ...
174174
# ---------------------------------------------------------------------------
175175
req_pack = [
176-
"regex", "dbf", "polib", "requests", "datetime", "gmpy2", "webbrowser",
177-
"locale", "io", "random", "ipapi", "string", "capstone", "pefile",
178-
"httpx", "ctypes", "sqlite3", "configparser", "traceback", "bs4",
179-
"PyQt5", "PyQt5.QtWebEngineWidgets",
180-
"screeninfo", "pathlib", "timer",
176+
"dbf", "polib", "requests", "datetime", "gmpy2", "webbrowser",
177+
"locale", "io", "random", "ipapi", "string", "capstone",
178+
"httpx", "ctypes", "sqlite3", "configparser", "traceback",
179+
"PyQt5", "PyQt5.QtWebEngineWidgets", "pefile", "bs4",
180+
"screeninfo", "pathlib", "timer", "regex",
181181
"marshal", "inspect", "logging", "rich", "string", "codecs",
182182
]
183183
for p in req_pack:
@@ -30111,6 +30111,12 @@ def mouseMoveEvent(self, ev):
3011130111
if self._resize_dir & self.LEFT:
3011230112
new_x = g.x() + dx
3011330113
new_w = g.right() - new_x + 1
30114+
# ---------------------------------------------
30115+
# title bar width not < 100 px
30116+
# ---------------------------------------------
30117+
if new_w <= 100:
30118+
return
30119+
3011430120
if new_w < minw:
3011530121
new_x = g.right() - (minw - 1)
3011630122
new_w = minw
@@ -30122,6 +30128,12 @@ def mouseMoveEvent(self, ev):
3012230128
# -------------------------------------------------
3012330129
if self._resize_dir & self.RIGHT:
3012430130
new_w = g.width() + dx
30131+
# ---------------------------------------------
30132+
# title bar width not < 100 px
30133+
# ---------------------------------------------
30134+
if new_w <= 100:
30135+
return
30136+
3012530137
if new_w < minw:
3012630138
new_w = minw
3012730139
g.setWidth(new_w)
@@ -30132,6 +30144,11 @@ def mouseMoveEvent(self, ev):
3013230144
if self._resizing and (self._resize_dir & self.TOP):
3013330145
new_y = g.y() + dy
3013430146
new_h = g.bottom() - new_y + 1
30147+
# ---------------------------------------------
30148+
# höhe vom title bar nicht kleiner als 33 px
30149+
# ---------------------------------------------
30150+
if new_h <= 33:
30151+
return
3013530152
if new_h < minh:
3013630153
new_y = g.bottom() - (minh - 1)
3013730154
new_h = minh
@@ -30214,7 +30231,7 @@ def eventFilter(self, obj, event):
3021430231
# ---------------------------------------------------
3021530232
if self._is_maximized_child or self.isMaximized():
3021630233
return True
30217-
30234+
3021830235
# ----------------------------------------------
3021930236
# neue globale Top-Left Position = Maus - Offset
3022030237
# ----------------------------------------------
@@ -30267,6 +30284,7 @@ def __init__(self, parent=None):
3026730284
self.move(30,30)
3026830285
self.setBorderColor(QColor(100,100,200))
3026930286
self.setTitle("Example")
30287+
self.setStyleSheet("color:yellow;")
3027030288
self.show()
3027130289
def setText(self, text: str):
3027230290
pass
@@ -32258,7 +32276,7 @@ def main(argv=None) -> int:
3225832276
parser.print_help()
3225932277
return 0
3226032278
# ------------------------------------------------------------------------
32261-
if __name__ == '__main__':
32279+
if __name__ == 'client':
3226232280
# The Python 3+ or 3.12+ is required.
3226332281
major = sys.version_info[0]
3226432282
minor = sys.version_info[1]
@@ -32269,7 +32287,7 @@ def main(argv=None) -> int:
3226932287
# Determine the path to the script and its name.
3227032288
script = os.path.abspath(sys.argv[0])
3227132289
script_path, script_name = os.path.split(script)
32272-
script_path = os.path.abspath(script_path)
32290+
script_path = os.path.abspath(script_path)
3227332291

3227432292
sys.exit(main())
3227532293
else:

src/client.spec

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# ---------------------------------------------------------------------------
2+
# \file client.spec
3+
# \autror (c) 2024, 2025 Jens Kallup - paule32
4+
# All rights reserved
5+
#
6+
# \notes pyinstaller client.spec
7+
# ---------------------------------------------------------------------------
8+
import os
9+
import pathlib
10+
11+
spec_dir = pathlib.Path(os.getcwd()).resolve()
12+
src_dir = spec_dir / "."
13+
14+
a = Analysis(
15+
[
16+
str(src_dir / '__main__.py'),
17+
str(src_dir / 'client.py')
18+
],
19+
pathex = [ str(src_dir) ],
20+
binaries=[],
21+
datas = [
22+
('_internal/observer.ini', '_internal'),
23+
],
24+
hiddenimports = [
25+
'resources_rc'
26+
],
27+
hookspath=[],
28+
hooksconfig={},
29+
runtime_hooks=[],
30+
excludes=[],
31+
noarchive = False,
32+
optimize=0,
33+
)
34+
pyz = PYZ(a.pure)
35+
36+
exe = EXE(
37+
pyz, a.scripts, [],
38+
exclude_binaries = True,
39+
name = 'client',
40+
debug = False,
41+
bootloader_ignore_signals=False,
42+
strip = False,
43+
upx = True,
44+
console = True,
45+
disable_windowed_traceback=False,
46+
argv_emulation=False,
47+
target_arch=None,
48+
codesign_identity=None,
49+
entitlements_file=None,
50+
)
51+
coll = COLLECT(
52+
exe,
53+
a.binaries,
54+
a.datas,
55+
strip=False,
56+
upx=True,
57+
upx_exclude=[],
58+
name='client',
59+
)

src/satz.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python satz_analyse_de.py "ich gehe heute später nach hause"

src/satz.out

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
2+
T:\a\HelpNDocTools\HelpNDocTools\src>python satz_analyse_de.py "ich gehe heute sp�ter nach hause"
3+
{
4+
"step1": {
5+
"sentence": "ich gehe heute sp�ter nach hause",
6+
"tokens": [
7+
"ich",
8+
"gehe",
9+
"heute",
10+
"sp",
11+
"ter",
12+
"nach",
13+
"hause"
14+
],
15+
"unknown": [
16+
"ich",
17+
"gehe",
18+
"heute",
19+
"sp",
20+
"ter",
21+
"nach",
22+
"hause"
23+
],
24+
"suggestions": {
25+
"ich": [
26+
"ida"
27+
],
28+
"gehe": [
29+
"gehen",
30+
"geben",
31+
"geier",
32+
"gelb",
33+
"geld"
34+
],
35+
"heute": [
36+
"hauke",
37+
"heike",
38+
"helge",
39+
"herne"
40+
],
41+
"sp": [
42+
"sp�t"
43+
],
44+
"ter": [
45+
"tee",
46+
"t�r",
47+
"tag",
48+
"teuer",
49+
"theo"
50+
],
51+
"nach": [
52+
"nah",
53+
"nass",
54+
"nico",
55+
"noah"
56+
],
57+
"hause": [
58+
"hase",
59+
"hauke",
60+
"haus",
61+
"halle",
62+
"hans"
63+
]
64+
},
65+
"casing_warnings": [],
66+
"notes": [
67+
"Rechtschreibpr�fung gegen W�rterbuch (case-insensitive).",
68+
"Nomen-heuristik f�r Gro�-/Kleinschreibung (au�er am Satzanfang)."
69+
]
70+
},
71+
"step2": {
72+
"original": "ich gehe heute sp�ter nach hause",
73+
"normalized_suggestion": "Ich gehe heute sp�ter nach Hause.",
74+
"issues": [
75+
{
76+
"type": "casing",
77+
"pos": 0,
78+
"msg": "Satzanfang klein geschrieben.",
79+
"suggest": "Erstes Wort gro� schreiben."
80+
},
81+
{
82+
"type": "punctuation",
83+
"msg": "Kein Satzzeichen am Ende.",
84+
"suggest": "Punkt/Frage-/Ausrufezeichen setzen."
85+
},
86+
{
87+
"type": "fixed_phrase",
88+
"span": "nach hause",
89+
"msg": "Feste Wendung �nach Hause� gro� schreiben.",
90+
"suggest": "Hause gro�."
91+
}
92+
]
93+
}
94+
}

src/satz_README.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# Qt5 Satzanalyse (Python, PyQt5)
3+
4+
## Installation
5+
```bash
6+
pip install PyQt5 matplotlib pandas
7+
```
8+
9+
Wörterbuch-CSV "satz_de_woerterbuch.csv` in dieses Verzeichnis legen,
10+
oder im der GUI über **Wörterbuch laden“** aus laden.
11+
Optional "satz_analyse_config.json" daneben legen, um Regeln anzupassen.
12+
13+
## Start
14+
```bash
15+
python main.py
16+
```
17+
18+
## Hinweise
19+
- Farbliche Markierungen:
20+
- Rot: unbekannte Wörter
21+
- Orange: Groß-/Kleinschreibung (Heuristik)
22+
- Blau: feste Wendungen
23+
- Lila: Verb Heuristik
24+
- Magenta: doppelte Negation
25+
- Violett: Konjunktionsdopplung
26+
- Grau: Komma-Hinweis (nur in der Übersicht)
27+
- Grün: erkannte Flexionsformen (Verb/Nomen)
28+
- Rechtsklick/Tooltip über markierten Bereichen zeigt eine Kurzinfo.

src/satz_analyse.pdf

46.3 KB
Binary file not shown.

src/satz_analyse_chart.png

21.4 KB
Loading

src/satz_analyse_config.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"conjunctions": [
3+
"und",
4+
"oder",
5+
"aber",
6+
"denn",
7+
"doch",
8+
"sondern",
9+
"weil",
10+
"dass",
11+
"sowie",
12+
"bzw",
13+
"beziehungsweise",
14+
"sowohl",
15+
"als",
16+
"auch",
17+
"weder",
18+
"noch"
19+
],
20+
"fixed_phrases": [
21+
[
22+
"\\bzu hause\\b",
23+
"zu Hause"
24+
],
25+
[
26+
"\\bim allgemeinen\\b",
27+
"im Allgemeinen"
28+
],
29+
[
30+
"\\bim voraus\\b",
31+
"im Voraus"
32+
],
33+
[
34+
"\\bin ordnung\\b",
35+
"in Ordnung"
36+
],
37+
[
38+
"\\bin gefahr\\b",
39+
"in Gefahr"
40+
],
41+
[
42+
"\\bin frage\\b",
43+
"in Frage"
44+
]
45+
]
46+
}

0 commit comments

Comments
 (0)