fix badge position; purge remaining German user-reference comments
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
tobjend 2026-07-01 13:28:55 +02:00
parent 6b60e0131f
commit dc559a4aee
5 changed files with 31 additions and 31 deletions

View file

@ -1,2 +1,2 @@
FROM python:3.11-slim FROM python:3.11-slim
RUN pip install --no-cache-dir pytest RUN pip install --no-cache-dir pytest pyyaml

View file

@ -2,6 +2,8 @@
<p align="left"> <p align="left">
<img src="dervish-logo.png" alt="Dervish" width="180"> <img src="dervish-logo.png" alt="Dervish" width="180">
</p>
<p align="left">
<img src="https://ci.corentic.eu/api/badges/7/status.svg" alt="CI Pipeline Status"> <img src="https://ci.corentic.eu/api/badges/7/status.svg" alt="CI Pipeline Status">
</p> </p>

View file

@ -1,16 +1,16 @@
""" """
iLocal Kontext-basierte Inferenz (Bex 2007). iLocal context-based inference (Bex 2007).
Nach Bex et al. 2007: "Inferring XML Schema Definitions from XML Data" Per Bex et al. 2007: "Inferring XML Schema Definitions from XML Data"
Extrahiert aus YAML-Bäumen (Kontext, Sequenz)-Paare, wobei der Kontext Extracts (context, sequence) pairs from YAML trees, where context is
der YAML-Key (Container-Key) ist. the YAML key (container key).
Angepasst r YAML: Adapted for YAML:
- Kontext = YAML-Key, dessen Wert eine Liste ist (z.B. tasks, steps) - Context = YAML key whose value is a list (e.g. tasks, steps)
- Sequenz = Die item-Keys innerhalb dieser Liste (z.B. apt, template, service) - Sequence = item keys within that list (e.g. apt, template, service)
Anstatt Dateipfade zu verwenden (wie im XML-Kontext), arbeiten wir Uses container keys directly instead of file paths (design decision:
mit den Container-Keys direkt (Benutzer-Vorgabe: kein Dateipfad-Ballast). no path overhead).
""" """
import yaml import yaml

View file

@ -16,7 +16,7 @@ Generates:
def parse_expression(expr): def parse_expression(expr):
"""Zerlegt einen regulären Ausdruck in seine Bestandteile.""" """Split a regular expression into its components."""
if not expr or expr in ('', 'ε', ''): if not expr or expr in ('', 'ε', ''):
return [('empty', 'ε')] return [('empty', 'ε')]
@ -68,7 +68,7 @@ def parse_expression(expr):
def format_prompt_cardinality(quantifier): def format_prompt_cardinality(quantifier):
"""Gibt die deutsche Kardinalitätsbeschreibung für einen Quantifier zurück.""" """Return the cardinality description for a quantifier."""
mapping = { mapping = {
'': '# PFLICHT: Genau 1 mal erforderlich', '': '# PFLICHT: Genau 1 mal erforderlich',
'+': '# PFLICHT: 1 oder mehrmals erforderlich', '+': '# PFLICHT: 1 oder mehrmals erforderlich',
@ -80,18 +80,18 @@ def format_prompt_cardinality(quantifier):
def generate_template(expr, context_key=None, include_header=True): def generate_template(expr, context_key=None, include_header=True):
""" """
Generiert ein YAML-One-Shot-Template aus einem regulären Ausdruck. Generate a YAML one-shot template from a regular expression.
Args: Args:
expr: Der inferierte Ausdruck (String) expr: Inferred expression (string)
context_key: Name des YAML-Container-Keys (z.B. 'tasks') context_key: YAML container key (e.g. 'tasks')
include_header: Ob der Header-Teil (name, hosts) eingefügt wird include_header: Whether to include header section (name, hosts)
Returns: Returns:
String: YAML-Skelett mit Platzhaltern und Kardinalitätskommentaren YAML skeleton with placeholders and cardinality comments
""" """
if not expr or expr in ('', 'ε'): if not expr or expr in ('', 'ε'):
return "# Keine Struktur inferiert (leere Sequenzen oder keine Beispiele)" return "# No structure inferred (empty sequences or no examples)"
if include_header: if include_header:
lines = [ lines = [
@ -129,21 +129,21 @@ def generate_template(expr, context_key=None, include_header=True):
inner_expr = group_str[1:-1] inner_expr = group_str[1:-1]
if '|' in inner_expr: if '|' in inner_expr:
alts = inner_expr.split('|') alts = inner_expr.split('|')
lines.append(f"{indent}# WAHLWEISE (eines auswählen):") lines.append(f"{indent}# CHOOSE (pick one):")
for alt in alts: for alt in alts:
alt_clean = alt.strip() alt_clean = alt.strip()
lines.append(f"{indent}# - {alt_clean}: <Parameter für {alt_clean}>") lines.append(f"{indent}# - {alt_clean}: <params>")
if card: if card:
lines[-1] = f"{lines[-1]} {card}" lines[-1] = f"{lines[-1]} {card}"
else: else:
lines.append(f"{indent}- {inner_expr}: <Parameter für {inner_expr}> {card}") lines.append(f"{indent}- {inner_expr}: <params> {card}")
task_index += 1 task_index += 1
elif token[0] == 'name': elif token[0] == 'name':
name = token[1] name = token[1]
quantifier = token[2] quantifier = token[2]
card = format_prompt_cardinality(quantifier) card = format_prompt_cardinality(quantifier)
lines.append(f"{indent}- {name}: <Parameter für {name}> {card}") lines.append(f"{indent}- {name}: <params> {card}")
task_index += 1 task_index += 1
elif token[0] == 'pipe': elif token[0] == 'pipe':

View file

@ -1,14 +1,12 @@
""" """
YAMLTokenizer Extrahiert Token-Sequenzen aus Ansible YAML-Dateien. YAMLTokenizer Extracts token sequences from Ansible YAML files.
Nach Bex 2007/2010 wird jedes YAML-Dokument in eine Sequenz von Symbolen Per Bex 2007/2010, each YAML document is translated into a sequence of
(Token) übersetzt. Für Ansible: symbols (tokens). For Ansible:
- Ein Playbook eine Sequenz von Module-Namen (apt, service, template, ...) - A playbook one sequence of module names (apt, service, template, ...)
- include_tasks wird als terminaler Token behandelt (nicht rekursiv aufgelöst) - include_tasks is treated as a terminal token (not resolved recursively)
- block/rescue/always: Der block-Container selbst wird als Token erfasst, - block/rescue/always: the block container itself is a token,
der Inhalt wird NICHT tokenisiert (zu variabel laut Benutzer-Vorgabe) its content is NOT tokenized (too variable)
Die extrahierten Sequenzen dienen als Eingabe für die Automaten-Konstruktion.
""" """
import os import os