-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwechsel_modus.bat
More file actions
281 lines (242 loc) · 8.23 KB
/
wechsel_modus.bat
File metadata and controls
281 lines (242 loc) · 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
cls
echo.
echo ================================================================
echo ANONYMIFY - MODUS WECHSELN
echo ================================================================
echo.
if not exist config.toml (
echo FEHLER: config.toml nicht gefunden!
pause
exit /b 1
)
echo Aktueller Modus:
findstr "recognition_mode" config.toml
echo.
echo ----------------------------------------------------------------
echo VERFUEGBARE MODI:
echo ----------------------------------------------------------------
echo.
echo [1] FAST - Schnell (~0.1s)
echo Nur Pattern-Matching
echo Empfohlen fuer die meisten Nutzer
echo.
echo [2] BALANCED - Ausgewogen (~1s)
echo Pattern + Machine Learning
echo Bessere Erkennung von Namen ohne Titel
echo.
echo [3] ACCURATE - Maximal (~2-5s)
echo Pattern + grosses ML-Modell
echo Beste Genauigkeit
echo.
echo ----------------------------------------------------------------
echo.
set /p CHOICE="Waehle Modus (1/2/3) oder [Q] fuer Abbrechen: "
if /i "%CHOICE%"=="q" (
echo.
echo Abgebrochen!
timeout /t 2 >nul
exit /b 0
)
:: =================================================================
:: OPTION 1: FAST
:: =================================================================
if "%CHOICE%"=="1" (
echo.
echo [*] Wechsle zu FAST Modus...
:: Erstelle temporäre Python-Script für config update
echo import re > update_config.py
echo with open('config.toml', 'r', encoding='utf-8') as f: >> update_config.py
echo content = f.read() >> update_config.py
echo content = re.sub(r'recognition_mode = ".*"', 'recognition_mode = "fast"', content) >> update_config.py
echo with open('config.toml', 'w', encoding='utf-8') as f: >> update_config.py
echo f.write(content) >> update_config.py
python update_config.py
if errorlevel 1 (
echo FEHLER: Konnte config.toml nicht aktualisieren!
del update_config.py 2>nul
pause
exit /b 1
)
del update_config.py 2>nul
echo [OK] Modus auf FAST gesetzt!
echo.
echo HINWEIS: Die App muss neu gestartet werden!
goto end
)
:: =================================================================
:: OPTION 2: BALANCED
:: =================================================================
if "%CHOICE%"=="2" (
echo.
echo [*] Wechsle zu BALANCED Modus...
echo.
:: Prüfe ob spaCy installiert ist
python -c "import spacy" 2>nul
if errorlevel 1 (
echo [!] spaCy ist nicht installiert!
echo [*] Installiere spaCy und deutsches Modell...
echo Bitte warten, das kann 1-2 Minuten dauern...
echo.
if exist venv\Scripts\activate.bat (
call venv\Scripts\activate.bat
)
pip install spacy
if errorlevel 1 (
echo [FEHLER] Konnte spaCy nicht installieren!
pause
exit /b 1
)
python -m spacy download de_core_news_sm
if errorlevel 1 (
echo [FEHLER] Konnte Modell nicht downloaden!
echo Versuche manuelle Installation mit:
echo pip install https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-3.7.0/de_core_news_sm-3.7.0-py3-none-any.whl
pause
exit /b 1
)
echo [OK] spaCy und Modell erfolgreich installiert!
echo.
)
:: Update config.toml
echo import re > update_config.py
echo with open('config.toml', 'r', encoding='utf-8') as f: >> update_config.py
echo content = f.read() >> update_config.py
echo content = re.sub(r'recognition_mode = ".*"', 'recognition_mode = "balanced"', content) >> update_config.py
echo with open('config.toml', 'w', encoding='utf-8') as f: >> update_config.py
echo f.write(content) >> update_config.py
python update_config.py
if errorlevel 1 (
echo FEHLER: Konnte config.toml nicht aktualisieren!
del update_config.py 2>nul
pause
exit /b 1
)
del update_config.py 2>nul
echo [OK] Modus auf BALANCED gesetzt!
echo.
echo HINWEIS: Die App muss neu gestartet werden!
goto end
)
:: =================================================================
:: OPTION 3: ACCURATE
:: =================================================================
if "%CHOICE%"=="3" (
echo.
echo [*] Wechsle zu ACCURATE Modus...
echo.
:: Prüfe ob spaCy installiert ist
python -c "import spacy" 2>nul
if errorlevel 1 (
echo [!] spaCy ist nicht installiert!
echo [*] Installiere spaCy zuerst...
echo.
if exist venv\Scripts\activate.bat (
call venv\Scripts\activate.bat
)
pip install spacy
if errorlevel 1 (
echo [FEHLER] Konnte spaCy nicht installieren!
pause
exit /b 1
)
)
:: Prüfe ob großes Modell installiert ist
python -c "import spacy; spacy.load('de_core_news_lg')" 2>nul
if errorlevel 1 (
echo [!] Grosses spaCy-Modell nicht gefunden!
echo [*] Lade grosses Modell herunter...
echo ACHTUNG: Das Modell ist ca. 500 MB gross!
echo Download kann 5-10 Minuten dauern...
echo.
choice /c JN /m "Moechtest du fortfahren"
if errorlevel 2 (
echo Abgebrochen!
pause
exit /b 0
)
echo.
echo Starte Download...
python -m spacy download de_core_news_lg
if errorlevel 1 (
echo.
echo [FEHLER] Konnte Modell nicht downloaden!
echo.
echo Moegliche Loesungen:
echo 1. Versuche es spaeter nochmal (GitHub Rate Limit)
echo 2. Nutze BALANCED Modus stattdessen
echo.
echo Soll ich auf BALANCED Modus wechseln? (kleines Modell)
choice /c JN /m "Auf BALANCED wechseln"
if errorlevel 2 (
echo Abgebrochen!
pause
exit /b 1
)
:: Wechsle zu BALANCED
echo.
echo [*] Wechsle zu BALANCED Modus...
python -m spacy download de_core_news_sm
if errorlevel 1 (
echo [FEHLER] Auch kleines Modell konnte nicht geladen werden!
pause
exit /b 1
)
:: Update config zu balanced
echo import re > update_config.py
echo with open('config.toml', 'r', encoding='utf-8') as f: >> update_config.py
echo content = f.read() >> update_config.py
echo content = re.sub(r'recognition_mode = ".*"', 'recognition_mode = "balanced"', content) >> update_config.py
echo with open('config.toml', 'w', encoding='utf-8') as f: >> update_config.py
echo f.write(content) >> update_config.py
python update_config.py
del update_config.py 2>nul
echo [OK] Modus auf BALANCED gesetzt!
echo.
goto end
)
echo.
echo [OK] Grosses Modell erfolgreich installiert!
echo.
)
:: Update config.toml zu accurate
echo import re > update_config.py
echo with open('config.toml', 'r', encoding='utf-8') as f: >> update_config.py
echo content = f.read() >> update_config.py
echo content = re.sub(r'recognition_mode = ".*"', 'recognition_mode = "accurate"', content) >> update_config.py
echo with open('config.toml', 'w', encoding='utf-8') as f: >> update_config.py
echo f.write(content) >> update_config.py
python update_config.py
if errorlevel 1 (
echo FEHLER: Konnte config.toml nicht aktualisieren!
del update_config.py 2>nul
pause
exit /b 1
)
del update_config.py 2>nul
echo [OK] Modus auf ACCURATE gesetzt!
echo.
echo HINWEIS: Die App muss neu gestartet werden!
goto end
)
echo.
echo [FEHLER] Ungueltige Auswahl!
pause
exit /b 1
:end
echo.
echo ----------------------------------------------------------------
echo.
set /p RESTART="Moechtest du die App jetzt neu starten? [J/N]: "
if /i "%RESTART%"=="j" (
echo.
echo [*] Starte App neu...
start "" start.bat
exit
)
echo.
echo Fertig! Starte die App manuell neu mit start.bat
echo.
pause