Note that this was made with Claude and DeepSeek AI, I don't know how to state that because I'm new with using GitHub.
A script that estimates a QCAA-compliant word count for a .docx file, following
the QCAA rules on what counts and what doesn't (headings, quotations, tables,
footnotes, citations, appendixes, etc.) rather than just reporting Word's raw
word count.
Word's own count treats every visible word the same way. QCAA's rules don't — raw data tables, bibliographies, citations, and standalone numbers are meant to be excluded, while headings, quotations, and abbreviations are meant to be included. This script automates the parts of that distinction that a computer can reliably make, and asks you a quick question for the parts that genuinely need a human judgement call.
I've made sure to try to make it super user friendly, using rich text to add colours to make things a bit more fun!
Power users: see advanced.md for terminal usage, flag reference, and workflows.
- Counts all body text: paragraphs, headings/subheadings, table text and quotations (these are just normal text, nothing special needed)
- Strips out standalone numbers/symbols (
42,3.14,%) while keeping abbreviations, units and chemical formulas (kg,KOH,LPG,37kg) - Reads footnotes/endnotes directly from the file and asks once whether they're bibliography-only
- Detects text inserted via Word's built-in Citation tool (or
EndNote/Zotero), and typed-out citations like
(Smith, 2020)orSmith (2020)— listing each unique one so you can undo a false positive - Finds headings that look like Contents/Abstract/Bibliography/ References/Appendix and excludes everything under them
- Lets you decide, table by table, whether it's raw/processed data only
- Breaks the final count down heading by heading, so you can see which sections are eating the most words
- Correctly handles merged table cells (a common source of accidental over- or under-counting in naive word-count scripts)
https://www.qcaa.qld.edu.au/senior/certificates-and-qualifications/qce-qcia-handbook/8-school-assessment-policies/8.2-integrating-learning-assessment
-
Citations in a format the pattern-matcher doesn't recognise (it looks for
(Author, Year)/Author (Year)shapes — numbered styles like[1]aren't currently covered) I do not have plans currently to add support for styles OTHER THAN APA 7 -
Text inside floating text boxes, or a table nested inside another table (both are edge cases python-docx doesn't expose directly)
-
Struct-based exclusion (Contents/References/etc.) relies on the section titles actually using Word's Heading 1/2/3... paragraph styles. If a document was drafted in Google Docs and pasted into Word without reapplying heading styles, none of that structural detection will fire — apply real heading styles first.
Requires Python 3.8+. I've used it on Thonny and VsCode, try it on one of those, but any Python 3.8 install with pip should work
pip install -r requirements.txt(or just pip install python-docx)
python qcaa_word_count.py "path/to/your/file.docx"Or run it with no argument and it will either open a file picker (if a graphical environment is available, best on Thonny and VsCode) or ask you to paste a path.
The script then opens a colour-coded preview of your document in your browser. Every decision is made there, not in the terminal: pick a word or press one of the Count / Exclude buttons and the tool recalculates and saves your choices immediately.
- tables — count the table's words, exclude it, or count the header row only (numbers, symbols and equations inside a counted table still don't count)
- captions, text boxes and appendixes — count or exclude each one (captions are suggested excluded: QCAA treats visual elements as excluded, but count them if your marker wants captions included)
- footnotes/endnotes — bibliographic or commentary
- citations — any the detector flagged that should actually count
- sections — references, contents, abstract, title page, appendix
- individual words — Ctrl+click any coloured word
When you are finished, press Done in the page (or Ctrl+C in the terminal). The terminal then prints the report: the estimated word count, a breakdown of what was excluded and why, and a per-heading breakdown of the final count.
Prefer answering prompts in the terminal instead? Add --no-serve.
This is an estimation tool, not an official QCAA word-count certification. Some exclusion/inclusion calls in the QCAA rules are genuinely subjective (e.g. whether a table counts as "raw/processed data" or "other information"). Always sanity-check the final number, especially around tables, footnotes, and any citation style the pattern-matcher might not recognise. I do not plan on adding the additional features shown in the example section just yet. This was also made with Claude AI and DeepSeek AI
Issues and pull requests welcome — in particular around detecting additional citation styles, text box / nested table support, and extracting text from figures and diagrams. Please ask any question or leave any comments in the Discussions section, I will do my best to answer them!