#!/usr/bin/env python3
"""Measure agreement between two raters on band scores (speaking or writing).
CSV columns: student, rater_a, rater_b (optional: criterion). Scores are integers on the same band scale.
Reports exact and adjacent (within one band) agreement, quadratic weighted kappa, each rater's mean (severity),
and cases two or more bands apart that need a third rating.
Findings:
RA001 high exact + adjacent agreement under 90%
RA002 medium weighted kappa under 0.60
RA003 low raters' means differ by more than 0.5 band (one is harsher)
RA004 low scores two or more bands apart (listed: rate a third time)
Usage:
python rater_agreement.py scores.csv
Exit codes: 0 no high findings, 1 high findings, 2 read error or bad CSV.
"""
import argparse
import csv
import sys
def weighted_kappa(a, b):
cats = list(range(min(a + b), max(a + b) + 1))
n, k = len(a), len(cats)
if k < 2:
return 1.0
obs = [[0] * k for _ in range(k)]
for x, y in zip(a, b):
obs[x - cats[0]][y - cats[0]] += 1
ra = [sum(row) for row in obs]
rb = [sum(obs[i][j] for i in range(k)) for j in range(k)]
w = lambda i, j: (i - j) ** 2 / (k - 1) ** 2
o = sum(w(i, j) * obs[i][j] for i in range(k) for j in range(k)) / n
e = sum(w(i, j) * ra[i] * rb[j] for i in range(k) for j in range(k)) / n ** 2
return 1 - o / e if e else 1.0
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("csv")
a = ap.parse_args()
try:
with open(a.csv, newline="", encoding="utf-8-sig") as fh:
rows = list(csv.DictReader(fh))
pairs = [(r["student"].strip() + (f" ({r['criterion']})" if r.get("criterion") else ""),
int(r["rater_a"]), int(r["rater_b"])) for r in rows]
except (OSError, csv.Error, KeyError, ValueError) as e:
print(f"error: needs student, rater_a and rater_b with whole-number bands ({e})", file=sys.stderr)
return 2
if len(pairs) < 2:
print("error: need at least two double-rated performances", file=sys.stderr)
return 2
xa, xb = [p[1] for p in pairs], [p[2] for p in pairs]
n = len(pairs)
exact = sum(x == y for x, y in zip(xa, xb)) / n
adj = sum(abs(x - y) == 1 for x, y in zip(xa, xb)) / n
kappa = weighted_kappa(xa, xb)
ma, mb = sum(xa) / n, sum(xb) / n
print(f"{n} double-rated performances")
print(f"Exact agreement {100 * exact:.0f}%, adjacent {100 * adj:.0f}%, within one band {100 * (exact + adj):.0f}%")
print(f"Quadratic weighted kappa {kappa:.2f}")
print(f"Mean band: rater A {ma:.2f}, rater B {mb:.2f}")
f = []
if round(exact + adj, 6) < 0.9:
f.append(("RA001", "high", f"only {100 * (exact + adj):.0f}% within one band: re-standardise raters"))
if kappa < 0.6:
f.append(("RA002", "medium", f"weighted kappa {kappa:.2f} is below 0.60"))
if abs(ma - mb) > 0.5:
f.append(("RA003", "low", f"rater {'A' if ma < mb else 'B'} is harsher by {abs(ma - mb):.2f} bands on average"))
for name, x, y in pairs:
if abs(x - y) >= 2:
f.append(("RA004", "low", f"{name}: {x} vs {y}; needs a third rating"))
order = {"high": 0, "medium": 1, "low": 2}
for code, sev, msg in sorted(f, key=lambda z: (order[z[1]], z[0])):
print(f"{code} [{sev}] {msg}")
return 1 if any(z[1] == "high" for z in f) else 0
if __name__ == "__main__":
sys.exit(main())
academic-english-eap-course-planner
Plan English for Academic Purposes (EAP) courses: pre-sessional, in-sessional, foundation, IELTS preparation and discipline-specific EAP, with syllabus strands (academic reading, lecture listening and note-taking, essay and report writing, paraphrase, summary and synthesis, referencing and plagiarism, seminars and presentations, academic vocabulary, critical thinking), a 10-week pre-sessional outline, exit assessment, IELTS-CEFR alignment and academic style (formality, hedging, cohesion, reporting verbs). Estimates study hours and weeks to close an IELTS gap from overall or per-skill scores (IELTS rounding, minimum per skill, priority skills, feasibility before a deadline), and checks learner texts for contractions, informal words with academic alternatives, unhedged claims, 'you', And/But/So starts, rhetorical questions and missing citations.
actfl-proficiency-curriculum-mapper
Map world language curricula to the ACTFL framework: proficiency levels (Novice, Intermediate, Advanced, Superior, Distinguished with sublevels), functions, contexts, text types and accuracy, proficiency vs performance, the three modes of communication (interpretive, interpersonal, presentational), the 5 Cs World-Readiness Standards, backward-designed thematic units with Integrated Performance Assessments, typical programme targets and FSI time estimates. Looks up approximate ACTFL-CEFR-ILR equivalences with what each level can do, and checks a unit map for missing modes, rehearsed skits mislabelled as interpersonal, translation or word lists as interpretive tasks, and units without an integrated performance assessment.
adult-literacy-esl-lesson-builder
Build lessons for adult ESL learners who are developing literacy (LESLLA learners: pre-literate, non-literate, semi-literate, literate in a non-Roman script): learner profiles and sensitive initial assessment, principles (oral language first, known to new, systematic phonics with adult-relevant text, repetition, classroom skills, respect for experience), a lesson routine (oral warm-up, review, new grapheme, blending, segmenting, decodable text, writing, functional literacy, Language Experience Approach), a phonics sequence for adults, sight words, functional literacy targets (forms, signs, medicine labels) and portfolio assessment. Checks whether a reading text is decodable with the letter-sound patterns and sight words taught so far, catching untaught digraphs, listing non-decodable words with the untaught part, and suggesting the most useful next patterns.
authentic-material-lesson-adapter
Turn authentic material (news articles, podcasts, videos, songs, menus, timetables, adverts, social media posts, forms, infographics) into language lessons by grading the task rather than the text. Selects texts for interest, relevance, exploitability, coverage, cultural load and rights; finds the 4-6 words to pre-teach, words to gloss on the page and words learners can ignore, plus names and cultural references to explain, with reading time by level; and builds a lesson shape (lead-in, pre-teach, gist or scanning, graded detail task, language focus on chunks and register, response) with task ideas per material type and level from A1 to C1. Covers copyright, fair dealing and fair use, Creative Commons and attribution.
can-do-statement-writer
Write and review can-do statements for language courses, units, lessons and learner self-assessment, CEFR or NCSSFL-ACTFL style: action (observable verb) + text or situation + level-specific conditions, learner ('I can') and descriptor ('Can') versions, progressions of one activity from A1 to C1, and coverage of reception, production, interaction and mediation. Includes a verb bank by mode and level and condition and text-type banks. Lints statements for teacher-centred phrasing, knowledge instead of use (learn, know, understand the passive), missing context, two skills in one statement, vague quality words, grammar items as outcomes, overlong statements and missing modes in a set.
cefr-aligned-syllabus-builder
Build language course syllabuses aligned to the CEFR (A1-C2, plus levels, Companion Volume 2020): entry and exit levels, guided learning hours and course length (with an L1-distance adjustment), syllabus type (topic, functional-notional, task-based, skills-based, multi-strand), unit-by-unit can-do outcomes, grammar from a core inventory by level, vocabulary, functions, pronunciation, balance of reception, production, interaction and mediation, recycling and assessment points. Checks a syllabus for units without can-do statements, core grammar for the level not covered, items above the course level, skills missing from most units and units with no vocabulary or functions.