Add --content-sizes #4
Reference in New Issue
Block a user
Delete Branch "content-sizes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
--content-sizes, which splits each revision intocontent_chars-- the information it carries -- and
markup_chars, the wikitext aroundit.
A travel guide gets written twice. Someone who does not know wikitext
contributes
Wonderful Hotel, +15555550123; someone who does comesalong later and writes
{{listing|name=Wonderful Hotel|phone=+15555550123}}. Both carry thesame information; the second adds two dozen characters of markup. This
measures that split, so the ratio reads directly as how much of a
revision is formatting rather than information.
The two columns sum to the revision length, which the end-to-end test
checks against a real dump.
One commit. Suite: 67 passed, 2 skipped.
After PR 1 merges, retarget this to
jsonl-output.Wikitravel-style guides get written twice. Someone who does not know wikitext contributes the information: Wonderful Hotel, +15555550123 and someone who does comes along later and polishes it: {{listing|name=Wonderful Hotel|phone=+15555550123}} Both carry the same information. The second adds two dozen characters of markup around it. --content-sizes measures that split, emitting two nullable int64 columns from a single mwparserfromhell tree walk per revision. content_chars counts what a contributor who did not know wikitext would have typed: text nodes, template parameter values, tag contents, wikilink labels (or targets when unlabeled), external link URLs and their labels, and heading titles. markup_chars is everything else -- braces, pipes, parameter names, tag names and attributes, link targets, quote marks, and comments, which never reach a reader. The two columns sum to the revision length, so their ratio reads directly as how much of a revision is formatting. That invariant is what the end-to-end test checks on a real dump, along with nulls for deleted revisions, which come through the same machinery as the other parser-based columns. Emphasis needs no special handling: mwparserfromhell represents ''' and '' as b and i tags, so the quote marks fall out as markup and the words they wrap as content, which is the wanted answer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.