Mehrsprachige Bedienung und versionierte Aufgabenvarianten einführen
Übersetzungskataloge, getrennte Sprachpräferenzen und einen versionierten Aufgabenpilot ergänzen. Historische Aufgaben und Bewertungen bleiben erhalten; äquivalente Ansichten teilen Nachweise. Lokal mit Race-Tests und PostgreSQL, Vet, Web-Build, Bank-Audits und Browser-Fixtures geprüft. Dieser Stand dient als Ausgangspunkt für die anschließend beauftragte Zusammenführung zur Muttersprache.
This commit is contained in:
@@ -46,3 +46,6 @@ for e in changed:
|
||||
assert len(t['answer_key']['rubric'])>=4 and 'Werte aus der Beispielantwort sind nicht verbindlich.' in ' '.join(t['answer_key']['rubric']),e['id']
|
||||
assert all(e['id'].startswith('a1bank_en_v1_') for e in entries if e not in changed)
|
||||
print('PASS: 144 reviewed grammar keys, 144 contextual vocabulary items, 144 factual scenes; 840 outputs, 42 balanced buckets, media completeness and balanced choice positions.')
|
||||
|
||||
from variants import audit as audit_variants
|
||||
audit_variants()
|
||||
|
||||
@@ -75,4 +75,7 @@ def build():
|
||||
name=module+'.'+skill+'.json';data=(json.dumps(entries,ensure_ascii=False,indent=2)+'\n').encode();(DEST/name).write_bytes(data);manifest['files'][name]=hashlib.sha256(data).hexdigest()
|
||||
(DEST/'manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
|
||||
print('Wrote 840 editorial exercises in 42 files.')
|
||||
if __name__=='__main__':build()
|
||||
if __name__=='__main__':
|
||||
build()
|
||||
from variants import build as build_variants
|
||||
build_variants()
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
"Open speaking content/language criteria are separated from Azure pronunciation scores."
|
||||
],
|
||||
"sources": {
|
||||
"audit.py": "5c4d78b1f2afe07a3aa6f5fd3fcca98d0fa3caaa1d3086fd8355100c241ea407",
|
||||
"build.py": "7896dac6fecc35f174d0fa3a70249ec3a86cc7c38e48307966a86444d9c2a0da",
|
||||
"audit.py": "ec8ad1842390b03ef366726e81baa3f6d24d03165e83aff757de876918e036cf",
|
||||
"build.py": "e9c047217c6b850e98d88c1ea86995e74fd398915089f51f9552a52c7eb3e077",
|
||||
"daily_life.grammar.txt": "0b84ee5b65e2fdf63add826c372c1438215a48c9731c266601ba9160e0e25192",
|
||||
"daily_life.stories.txt": "62bd24776fd4bbbdf7bf5e926f1452f7720e8b061394dced91ff7cc46aed2e03",
|
||||
"daily_life.vocabulary.txt": "4db8b0cf43b1f154e315cefe82970e32e410e61edb047d517ad7310e5aff23aa",
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"revision": "introductions-en-explanations-v1",
|
||||
"reviewed": true,
|
||||
"reviewer": "Codex editorial pass",
|
||||
"entry_count": 12,
|
||||
"method": "Offline editorial review of all twelve visible instructions, options, reference answers and rubrics. Structural checks supplement this review; no external teacher certification or live model-quality claim.",
|
||||
"findings_addressed": [
|
||||
"English explanation and learning language are identical: two vocabulary meaning tasks use contextual definitions, not identity translations.",
|
||||
"One short-writing translation task is replaced by explicitly guided composition with the required name visible. These three adaptations have new canonical identities.",
|
||||
"Nine translations retain the assessed requirements, option IDs, answer keys, target texts, and private listening media.",
|
||||
"Free answers explicitly permit real or invented details. Reference names are examples, except the explicitly requested Anna in guided composition.",
|
||||
"Free speech content/language and Azure pronunciation remain separate.",
|
||||
"The pilot module has reviewed English display labels; module IDs and learning goals are unchanged."
|
||||
],
|
||||
"sources": {
|
||||
"variants.py": "fed9ca7f9a3be47bd766729b386696b115bf4016a16e3c6163b2ec8608868843",
|
||||
"variant_sources.json": "0a8c2445c432d4a8cf62e8d8e922a1be2cf6f4e146cbe2a52d19722c84b075f3",
|
||||
"introductions.grammar.txt": "63908be080f56268d3cf0ea03f827177d332d4a23f1e01c5a3fbb513e8b2eccf",
|
||||
"introductions.vocabulary.txt": "c120cdb9ccf7d70c1f61c8fcbee0bcffc8e474ceae420edcb9c59eee8b2356f1",
|
||||
"introductions.stories.txt": "d187cc61ad8873c5a8c53d956f7b723689218364cce5e196c59ebbadda48405c",
|
||||
"open_instructions.json": "dc6e2239a146080c8eb2f6d54f3877c5e01afaa9d4b196104184bb6623f24728"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"instruction_language": "en-US",
|
||||
"target_language": "en-US",
|
||||
"module_id": "a1_introductions_v1",
|
||||
"revision": "introductions-en-explanations-v1",
|
||||
"entries": [
|
||||
{
|
||||
"skill": "grammar",
|
||||
"number": 1,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Complete the sentence.",
|
||||
"stimulus": {
|
||||
"role": "target",
|
||||
"language": "en-US",
|
||||
"text": "I ___ Anna."
|
||||
},
|
||||
"explanation": "Use am after I."
|
||||
},
|
||||
{
|
||||
"skill": "grammar",
|
||||
"number": 2,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Complete the sentence.",
|
||||
"stimulus": {
|
||||
"role": "target",
|
||||
"language": "en-US",
|
||||
"text": "You ___ my friend."
|
||||
},
|
||||
"explanation": "Use are after you."
|
||||
},
|
||||
{
|
||||
"skill": "vocabulary",
|
||||
"number": 1,
|
||||
"equivalence": "adaptation",
|
||||
"instruction": "What does hello mean in this sentence?",
|
||||
"stimulus": {
|
||||
"role": "target",
|
||||
"language": "en-US",
|
||||
"text": "Hello, I am Anna."
|
||||
},
|
||||
"option_meanings": {
|
||||
"hallo": "a greeting",
|
||||
"tschüss": "a farewell",
|
||||
"bitte": "a polite request"
|
||||
},
|
||||
"explanation": "Hello is a greeting. We use it when we meet someone."
|
||||
},
|
||||
{
|
||||
"skill": "vocabulary",
|
||||
"number": 2,
|
||||
"equivalence": "adaptation",
|
||||
"instruction": "What does name mean in this sentence?",
|
||||
"stimulus": {
|
||||
"role": "target",
|
||||
"language": "en-US",
|
||||
"text": "My name is Ben."
|
||||
},
|
||||
"option_meanings": {
|
||||
"Name": "what a person is called",
|
||||
"Alter": "how old someone is",
|
||||
"Wohnort": "where someone lives"
|
||||
},
|
||||
"explanation": "A name is what a person is called. The person's name here is Ben."
|
||||
},
|
||||
{
|
||||
"skill": "reading",
|
||||
"number": 1,
|
||||
"equivalence": "translation",
|
||||
"instruction": "What is the person's name?",
|
||||
"explanation": "The text says: My name is Anna. The correct answer is Anna."
|
||||
},
|
||||
{
|
||||
"skill": "reading",
|
||||
"number": 2,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Which country is Ben from?",
|
||||
"explanation": "The text says: Ben is from Canada. The correct answer is Canada."
|
||||
},
|
||||
{
|
||||
"skill": "listening",
|
||||
"number": 1,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Which country is Anna from?",
|
||||
"explanation": "The recording says: I am from Spain. The correct answer is Spain."
|
||||
},
|
||||
{
|
||||
"skill": "listening",
|
||||
"number": 2,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Where does Ben live?",
|
||||
"explanation": "The recording says: He lives in London. The correct answer is London."
|
||||
},
|
||||
{
|
||||
"skill": "speaking",
|
||||
"number": 1,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Repeat the English sentence.",
|
||||
"explanation": "Repeat the complete sentence clearly. Pronunciation feedback uses only available speech measurements.",
|
||||
"rubric": [
|
||||
"Repeat the displayed English sentence clearly.",
|
||||
"Do not claim pronunciation or fluency errors without actual Azure measurements."
|
||||
]
|
||||
},
|
||||
{
|
||||
"skill": "speaking",
|
||||
"number": 11,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Introduce yourself. Give a name and the country you are from. You may use real or invented details. Say two or three short English sentences in at most 30 seconds.",
|
||||
"explanation": "The example is only one possible answer. You may choose your own name and country. Content and language are assessed separately from Azure pronunciation.",
|
||||
"rubric": [
|
||||
"Introduce one person with a name and country of origin.",
|
||||
"Two or three short, understandable English sentences meet the required length.",
|
||||
"Real or invented names and countries are allowed. Facts in the example are not mandatory.",
|
||||
"Assess only the explicitly requested content and actual language errors. Do not penalise ambiguity in the task.",
|
||||
"For this free-speech response, assess content and English formulations only. Azure pronunciation is displayed separately and is not part of this score."
|
||||
]
|
||||
},
|
||||
{
|
||||
"skill": "writing",
|
||||
"number": 1,
|
||||
"equivalence": "adaptation",
|
||||
"instruction": "Write one short English sentence to introduce yourself. For this exercise, use the name Anna.",
|
||||
"stimulus": {
|
||||
"role": "context",
|
||||
"language": "en-US",
|
||||
"text": "Name: Anna"
|
||||
},
|
||||
"explanation": "My name is Anna. and I am Anna. are both valid answers. Use the name Anna as requested; other correct ways to introduce yourself are allowed.",
|
||||
"rubric": [
|
||||
"Write one understandable English sentence to introduce yourself using the explicitly requested name Anna.",
|
||||
"Accept My name is Anna., I am Anna. and other correct equivalent formulations.",
|
||||
"Consider actual A1 language errors proportionately. Do not invent additional requirements."
|
||||
]
|
||||
},
|
||||
{
|
||||
"skill": "writing",
|
||||
"number": 11,
|
||||
"equivalence": "translation",
|
||||
"instruction": "Introduce yourself. Give a name and the country you are from. You may use real or invented details. Write two or three short English sentences.",
|
||||
"explanation": "The example is only one possible answer. You may choose your own name and country. Only the explicitly requested information is required.",
|
||||
"rubric": [
|
||||
"Introduce one person with a name and country of origin.",
|
||||
"Two or three short, understandable English sentences meet the required length.",
|
||||
"Real or invented names and countries are allowed. Facts in the example are not mandatory.",
|
||||
"Assess only the explicitly requested content and actual language errors. Do not penalise ambiguity in the task."
|
||||
]
|
||||
}
|
||||
],
|
||||
"module_title": "Greetings & introductions",
|
||||
"module_description": "Greet people, introduce a name and origin; I am, my name is"
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
"""Offline build/audit of explicitly reviewed explanation-language variants."""
|
||||
import copy
|
||||
import hashlib
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
BASE = pathlib.Path(__file__).resolve().parent
|
||||
DEST = BASE.parents[1] / 'apps/api/internal/store/coursebank/variants'
|
||||
BANK = DEST.parent / 'en-US/a1-v2'
|
||||
|
||||
|
||||
def checked_sources():
|
||||
review_bytes = (BASE / 'variant_review.json').read_bytes()
|
||||
review = json.loads(review_bytes)
|
||||
assert review['reviewed'] and review['entry_count'] == 12
|
||||
for name, digest in review['sources'].items():
|
||||
assert hashlib.sha256((BASE / name).read_bytes()).hexdigest() == digest, f'Variant review is stale: {name}'
|
||||
return json.loads((BASE / 'variant_sources.json').read_text()), review_bytes
|
||||
|
||||
|
||||
def compile_variants():
|
||||
source, review_bytes = checked_sources()
|
||||
entries = []
|
||||
for row in source['entries']:
|
||||
candidates = json.loads((BANK / f'introductions.{row["skill"]}.json').read_text())
|
||||
base = candidates[row['number'] - 1]
|
||||
task = copy.deepcopy(base['task'])
|
||||
variant_id = f'intro_en_explanations_v1_{row["skill"]}_{row["number"]:02d}'
|
||||
canonical = base['id'] if row['equivalence'] == 'translation' else variant_id
|
||||
task.update(instruction_language=source['instruction_language'], variant_id=variant_id,
|
||||
canonical_task_id=canonical, content_revision=source['revision'], instruction=row['instruction'])
|
||||
task['prompt'] = row['instruction']
|
||||
if 'stimulus' in row:
|
||||
task['stimulus'] = row['stimulus']
|
||||
task['prompt'] += ' ' + row['stimulus']['text']
|
||||
key = task['answer_key']
|
||||
key['explanation'] = row['explanation']
|
||||
key['rubric'] = row.get('rubric', ['Choose the one answer supported by the sentence, word meaning or supplied text.'])
|
||||
key['reference_answer_language'] = source['instruction_language'] if task['skill'] == 'vocabulary' else task['target_language']
|
||||
for option in task.get('options', []):
|
||||
option['role'] = 'meaning' if task['skill'] == 'vocabulary' else 'target'
|
||||
option['language'] = source['instruction_language'] if option['role'] == 'meaning' else task['target_language']
|
||||
if 'option_meanings' in row:
|
||||
option['label'] = row['option_meanings'][option['label']]
|
||||
if option['id'] == key.get('correct_option_id'):
|
||||
key['reference_answer'] = option['label']
|
||||
entries.append(dict(id=variant_id, revision=source['revision'], base_entry_id=base['id'],
|
||||
canonical_task_id=canonical, instruction_language=source['instruction_language'],
|
||||
module_title=source['module_title'], module_description=source['module_description'],
|
||||
equivalence=row['equivalence'], reviewed=True, task=task))
|
||||
return entries, review_bytes
|
||||
|
||||
|
||||
def build():
|
||||
entries, review_bytes = compile_variants()
|
||||
DEST.mkdir(parents=True, exist_ok=True)
|
||||
data = (json.dumps(entries, ensure_ascii=False, indent=2) + '\n').encode()
|
||||
name = 'introductions.en-US.v1.json'
|
||||
(DEST / name).write_bytes(data)
|
||||
manifest = dict(total=len(entries), editorial_review_sha256=hashlib.sha256(review_bytes).hexdigest(),
|
||||
files={name: hashlib.sha256(data).hexdigest()})
|
||||
(DEST / 'manifest.json').write_text(json.dumps(manifest, indent=2) + '\n')
|
||||
print('Wrote 12 reviewed English-explanation pilot variants across six learning areas.')
|
||||
|
||||
|
||||
def audit():
|
||||
expected, review_bytes = compile_variants()
|
||||
manifest = json.loads((DEST / 'manifest.json').read_text())
|
||||
assert manifest['total'] == 12
|
||||
assert manifest['editorial_review_sha256'] == hashlib.sha256(review_bytes).hexdigest()
|
||||
actual = []
|
||||
for name, digest in manifest['files'].items():
|
||||
data = (DEST / name).read_bytes()
|
||||
assert hashlib.sha256(data).hexdigest() == digest
|
||||
actual += json.loads(data)
|
||||
assert actual == expected, 'Generated variants differ from reviewed editorial sources'
|
||||
assert len({entry['id'] for entry in actual}) == 12
|
||||
for entry in actual:
|
||||
task = entry['task']
|
||||
base = next(x for x in json.loads((BANK / f'introductions.{task["skill"]}.json').read_text()) if x['id'] == entry['base_entry_id'])
|
||||
assert task['target_language'] == task['instruction_language'] == 'en-US'
|
||||
assert task['module_id'] == 'a1_introductions_v1' and task['instruction']
|
||||
assert entry['equivalence'] in ('translation', 'adaptation')
|
||||
assert (entry['canonical_task_id'] == entry['base_entry_id']) == (entry['equivalence'] == 'translation')
|
||||
for field in ('audio_text', 'passage', 'reference_text'):
|
||||
assert task.get(field) == base['task'].get(field), (entry['id'], field)
|
||||
if task['kind'] == 'choice':
|
||||
assert task['answer_key']['correct_option_id'] == base['task']['answer_key']['correct_option_id']
|
||||
assert len({o['label'].casefold() for o in task['options']}) == 3
|
||||
if entry['equivalence'] == 'translation':
|
||||
assert [o['label'] for o in task['options'] if o['role'] == 'target'] == [o['label'] for o in base['task']['options']]
|
||||
assert all(o['role'] in ('target', 'meaning') and o['language'] for o in task['options'])
|
||||
if task['skill'] == 'listening':
|
||||
assert not task.get('stimulus'), 'A private recording must never become a public stimulus'
|
||||
assert sum(x['equivalence'] == 'adaptation' for x in actual) == 3
|
||||
assert {x['task']['kind'] for x in actual} == {'choice', 'repeat_sentence', 'free_speech', 'short_text', 'free_text'}
|
||||
assert all(sum(x['task']['skill'] == skill for x in actual) == 2 for skill in ('grammar', 'vocabulary', 'listening', 'reading', 'speaking', 'writing'))
|
||||
print('PASS: 12 pilot variants; 9 equivalent translations, 3 separate adaptations; preserved keys/media; six learning areas and five renderers.')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
build()
|
||||
audit()
|
||||
Reference in New Issue
Block a user