diff --git a/Dockerfile.ci b/Dockerfile.ci
index 33d86be..2195e0b 100644
--- a/Dockerfile.ci
+++ b/Dockerfile.ci
@@ -1,2 +1,2 @@
FROM python:3.11-slim
-RUN pip install --no-cache-dir pytest
+RUN pip install --no-cache-dir pytest pyyaml
diff --git a/README.md b/README.md
index ed60acd..247a240 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
+
+
diff --git a/bex/ilocal.py b/bex/ilocal.py
index d5b22eb..5b00a07 100644
--- a/bex/ilocal.py
+++ b/bex/ilocal.py
@@ -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"
-Extrahiert aus YAML-Bäumen (Kontext, Sequenz)-Paare, wobei der Kontext
-der YAML-Key (Container-Key) ist.
+Per Bex et al. 2007: "Inferring XML Schema Definitions from XML Data"
+Extracts (context, sequence) pairs from YAML trees, where context is
+the YAML key (container key).
-Angepasst für YAML:
- - Kontext = YAML-Key, dessen Wert eine Liste ist (z.B. tasks, steps)
- - Sequenz = Die item-Keys innerhalb dieser Liste (z.B. apt, template, service)
+Adapted for YAML:
+ - Context = YAML key whose value is a list (e.g. tasks, steps)
+ - Sequence = item keys within that list (e.g. apt, template, service)
-Anstatt Dateipfade zu verwenden (wie im XML-Kontext), arbeiten wir
-mit den Container-Keys direkt (Benutzer-Vorgabe: kein Dateipfad-Ballast).
+Uses container keys directly instead of file paths (design decision:
+no path overhead).
"""
import yaml
diff --git a/bex/template.py b/bex/template.py
index 1cebce6..47e573f 100644
--- a/bex/template.py
+++ b/bex/template.py
@@ -16,7 +16,7 @@ Generates:
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 ('∅', 'ε', ''):
return [('empty', 'ε')]
@@ -68,7 +68,7 @@ def parse_expression(expr):
def format_prompt_cardinality(quantifier):
- """Gibt die deutsche Kardinalitätsbeschreibung für einen Quantifier zurück."""
+ """Return the cardinality description for a quantifier."""
mapping = {
'': '# PFLICHT: Genau 1 mal 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):
"""
- Generiert ein YAML-One-Shot-Template aus einem regulären Ausdruck.
+ Generate a YAML one-shot template from a regular expression.
Args:
- expr: Der inferierte Ausdruck (String)
- context_key: Name des YAML-Container-Keys (z.B. 'tasks')
- include_header: Ob der Header-Teil (name, hosts) eingefügt wird
+ expr: Inferred expression (string)
+ context_key: YAML container key (e.g. 'tasks')
+ include_header: Whether to include header section (name, hosts)
Returns:
- String: YAML-Skelett mit Platzhaltern und Kardinalitätskommentaren
+ YAML skeleton with placeholders and cardinality comments
"""
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:
lines = [
@@ -129,21 +129,21 @@ def generate_template(expr, context_key=None, include_header=True):
inner_expr = group_str[1:-1]
if '|' in inner_expr:
alts = inner_expr.split('|')
- lines.append(f"{indent}# WAHLWEISE (eines auswählen):")
+ lines.append(f"{indent}# CHOOSE (pick one):")
for alt in alts:
alt_clean = alt.strip()
- lines.append(f"{indent}# - {alt_clean}: ")
+ lines.append(f"{indent}# - {alt_clean}: ")
if card:
lines[-1] = f"{lines[-1]} {card}"
else:
- lines.append(f"{indent}- {inner_expr}: {card}")
+ lines.append(f"{indent}- {inner_expr}: {card}")
task_index += 1
elif token[0] == 'name':
name = token[1]
quantifier = token[2]
card = format_prompt_cardinality(quantifier)
- lines.append(f"{indent}- {name}: {card}")
+ lines.append(f"{indent}- {name}: {card}")
task_index += 1
elif token[0] == 'pipe':
diff --git a/bex/tokenizer.py b/bex/tokenizer.py
index 39ff1dd..f20af2b 100644
--- a/bex/tokenizer.py
+++ b/bex/tokenizer.py
@@ -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
-(Token) übersetzt. Für Ansible:
- - Ein Playbook → eine Sequenz von Module-Namen (apt, service, template, ...)
- - include_tasks wird als terminaler Token behandelt (nicht rekursiv aufgelöst)
- - block/rescue/always: Der block-Container selbst wird als Token erfasst,
- der Inhalt wird NICHT tokenisiert (zu variabel laut Benutzer-Vorgabe)
-
-Die extrahierten Sequenzen dienen als Eingabe für die Automaten-Konstruktion.
+Per Bex 2007/2010, each YAML document is translated into a sequence of
+symbols (tokens). For Ansible:
+ - A playbook → one sequence of module names (apt, service, template, ...)
+ - include_tasks is treated as a terminal token (not resolved recursively)
+ - block/rescue/always: the block container itself is a token,
+ its content is NOT tokenized (too variable)
"""
import os