Skip to content
v0.1.4latest release159 skills5 categories7 sub-categories303 tested scripts468 reference docsContact us

academic_style_check.py

Helper script for academic-english-eap-course-planner · 86 lines

Languages, Linguistics & Translation / Language Teachingv1.0.0Updated OCT 25 20262 references2 scripts
scripts/academic_style_check.py
#!/usr/bin/env python3
"""Check a learner's academic text for informal style, unhedged claims and missing citations, with alternatives.

Checks:
  AS001 medium  contractions (don't, it's, can't)
  AS002 medium  informal words or phrasal verbs, with a more academic alternative
  AS003 medium  absolute claims (always, never, prove, everyone) and no hedging anywhere in the text
  AS004 low     second person 'you' addressing the reader
  AS005 low     sentences starting with And / But / So
  AS006 low     rhetorical questions
  AS007 low     no citations found (author-date or numbered) in a text over 150 words

Usage:
    python academic_style_check.py essay.txt

Exit codes: 0 no medium findings, 1 medium findings, 2 read error or empty text.
"""

import argparse
import re
import sys

ALT = {
    "a lot of": "many / much / a considerable amount of", "lots of": "many / numerous", "get": "obtain / become / receive",
    "got": "obtained / became", "big": "large / substantial / significant", "really": "(omit) / considerably",
    "very": "(omit) / highly / particularly", "thing": "factor / aspect / issue", "things": "factors / aspects / issues",
    "stuff": "material / items", "kids": "children", "ok": "acceptable", "okay": "acceptable", "pretty": "fairly / rather",
    "find out": "discover / determine", "look into": "investigate / examine", "go up": "increase / rise",
    "go down": "decrease / decline", "cut down": "reduce", "set up": "establish", "deal with": "address / handle",
    "come up with": "propose / develop", "point out": "note / observe", "talk about": "discuss / examine",
    "nowadays": "currently / at present", "bad": "negative / harmful / poor", "good": "beneficial / effective / positive",
    "show up": "appear / emerge", "figure out": "determine / establish",
}
ABSOLUTE = re.compile(r"\b(always|never|everyone|everybody|nobody|all people|proves?|proved|certainly|undoubtedly|"
                      r"definitely|obvious(ly)?)\b", re.I)
HEDGE = re.compile(r"\b(may|might|could|suggests?|tends? to|appears?|seems?|likely|possibly|arguably|perhaps|"
                   r"to some extent|in many cases|indicates?)\b", re.I)
CITE = re.compile(r"\([A-Z][A-Za-z'-]+(?: et al\.)?(?: and [A-Z][A-Za-z'-]+)?,? \d{4}|[A-Z][A-Za-z'-]+ \(\d{4}\)|\[\d+\]")


def main():
    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
    ap.add_argument("text", help="text file, or - for stdin")
    a = ap.parse_args()
    try:
        text = (sys.stdin if a.text == "-" else open(a.text, encoding="utf-8")).read()
    except OSError as e:
        print(f"error: {e}", file=sys.stderr)
        return 2
    words = re.findall(r"[A-Za-z][A-Za-z'-]*", text)
    if not words:
        print("error: empty text", file=sys.stderr)
        return 2
    low = text.lower()
    f = []
    contractions = sorted({m.group(0).lower() for m in re.finditer(r"\b\w+n't\b|\b(it|that|there|he|she|they|we|i|you)'(s|re|ll|d|ve|m)\b", text, re.I)})
    if contractions:
        f.append(("AS001", "medium", "contractions: " + ", ".join(contractions)))
    informal = [(k, v) for k, v in ALT.items() if re.search(rf"\b{re.escape(k)}\b", low)]
    for k, v in informal:
        f.append(("AS002", "medium", f"'{k}' -> {v}"))
    absolutes = sorted({m.group(0).lower() for m in ABSOLUTE.finditer(text)})
    if absolutes and not HEDGE.search(text):
        f.append(("AS003", "medium", f"absolute claims ({', '.join(absolutes)}) and no hedging: use may, tend to, suggests, in many cases"))
    if re.search(r"\byou(r)?\b", low):
        f.append(("AS004", "low", "'you' addresses the reader: use impersonal forms (one, people, it is ...)"))
    starts = sorted({m.group(1) for m in re.finditer(r"(?:^|[.!?]\s+)(And|But|So)\b", text)})
    if starts:
        f.append(("AS005", "low", f"sentences start with {', '.join(starts)}: use However, Therefore, In addition"))
    if re.search(r"\?\s", text + " "):
        f.append(("AS006", "low", "rhetorical question(s): turn them into statements"))
    cites = len(CITE.findall(text))
    if len(words) > 150 and not cites:
        f.append(("AS007", "low", "no citations: support claims with sources (Author, year)"))
    print(f"{len(words)} words; hedges {len(HEDGE.findall(text))}; citations {cites}")
    order = {"medium": 0, "low": 1}
    for code, sev, msg in sorted(f, key=lambda x: (order[x[1]], x[0])):
        print(f"{code} [{sev}] {msg}")
    if not f:
        print("OK: formal, hedged and referenced")
    return 1 if any(x[1] == "medium" for x in f) else 0


if __name__ == "__main__":
    sys.exit(main())
More in Language Teaching

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.

classroom-management-for-esl-coach

Coach ESL/EFL teachers in classroom management: the instruction sequence (attention, group first, graded imperatives, demonstration, ICQs, hand out, start, check), ICQ examples, online instructions, routines for the first weeks (class agreement, L1 use, phones, lateness, homework, seating), strategies for L1 use in tasks, dominant and quiet learners, mixed levels, large classes, fast finishers, low motivation, disruptive young learners and teens, cultural expectations, classroom language to teach early and teacher presence. Checks planned instructions for length, missing ICQs, useless ICQs like 'Do you understand?', no demonstration, long sentences, filler and missing grouping or timing, and builds seating plans that keep named learners apart, seat learners who need the front, mix first languages and alternate stronger and weaker learners.