Wikipedia talk:Prosesize

Latest comment: 4 months ago by Hawkeye7 in topic Java error resulting from #chart

Bug: Counting Spaces?

edit

@Galobtter: the script uses .split( ' ' ) to split words. If there are two spaces in a row, that is counted as 1 word. Is that the intended behavior? I have made a PR to change it to .split( /\s+/ ) where it splits at all continuous white spaces instead. Merge if you think it's better. Thanks!

How do I use it?

edit

@Galobtter: I cannot find where the toolbox for this gadget is supposed to be and it is not mentioned in the documentation. Veverve (talk) 04:00, 26 November 2021 (UTC)Reply

Idem. Joshua Jonathan -Let's talk! 09:57, 5 January 2022 (UTC)Reply

@Kusma: could you help us figuring out how to use this gadget? Veverve (talk) 22:13, 17 February 2022 (UTC)Reply

@Veverve, @Joshua Jonathan, you should find the link "Page size" in the "Tools" box on the left of the screen if you are using the Vector or Monobook skin on a desktop with sufficiently large window. In desktop mode on a phone, it may be hidden behind a "tools" symbol that you need to click to open. I don't use mobile mode, so I wouldn't know whether it is accessible there. If you can't get it to work at all, try to describe your preferences settings and what kind of browser and window size you use and ask at the help desk or at the technical village pump if the help desk can't help you. —Kusma (talk) 22:23, 17 February 2022 (UTC)Reply
@Kusma: found it, thanks a lot! Veverve (talk) 22:38, 17 February 2022 (UTC)Reply

Bug? Looks like something is counted that should not be

edit

At Ludwig Ferdinand Huber, prosesize gives me 4257 B. (Xtools has 4281 B). After this edit, prosesize counts 2352 B and Xtools articleinfo gives 2368 B. While it is normal that removing the EB template by adding a * should reduce the prose size by around 300 B, there seem to be about 1700 B of extra material that is invisible, yet is being counted. @Izno suggested on Discord that this could be the This edit request to MediaWiki:Gadget-Prosesize.js has been answered. Set the |answered= parameter to no to reactivate your request.

On line 40, please wrap mw.config.get( 'wgPageName' ) in mw.Uri.encode(), to prevent the gadget from not working on pages with special characters like colons and forward slashes.

Diff:

+ mw.config.get( 'wgPageName' ) + '?revision=' + mw.config.get( 'wgRevisionId' ) );
+
+ mw.Uri.encode( mw.config.get( 'wgPageName' ) ) + '?revision=' + mw.config.get( 'wgRevisionId' ) );

mw (talk) (contribs) 23:27, 25 November 2023 (UTC)Reply

 Done Done using javascript encodeURIComponent; I think no need to add a dependency on mediawiki.Uri. Galobtter (talk) 00:05, 26 November 2023 (UTC)Reply
I've moved this request from MediaWiki talk:Gadget-Prosesize.js to centralize discussion. Galobtter (talk) 00:06, 26 November 2023 (UTC)Reply

Getting prose sizes for a *group* of articles

edit

Hello! Is it possible to use this tool to get a list of articles ordered by prose size? Ideally, this would replace User talk:Dr pda/generatestats.js so that we can see the longest/shortest articles that use a good or featured article template. Having access to this info could significantly impact the proposal at Wikipedia talk:Good article nominations#Proposal: mandate compliance with WP:TOOBIG in GA criterion 3b.

Currently, Dr pda's script still works but will only pull 500 articles (see examples 1, 2). Petscan will only return info based on the article's total size in wikicode, which can be very different from a word count (e.g. Phillippines).

Thanks for any help y'all can provide! cc Galobtter, Legoktm. Ed [talk] [OMT] 08:52, 12 January 2024 (UTC)Reply

Hi Ed! I set up Wikipedia:Database reports/Featured articles by size a while back based on a similar request, do you want the same thing for good articles? There are 38k, so presumably it'll be split over multiple pages. Or are you looking for something else? Legoktm (talk) 17:27, 12 January 2024 (UTC)Reply
Hello Legoktm! Hope you're doing well. :-) I completely missed that page. Thanks for sharing it. So, I'm not sure what the effort level is to accomplish this. For the purposes of the linked discussion + for the GA project more broadly, my thought is that they'd only really utilize lists of the shortest/longest GAs. If that's a trivial ask, fantastic. But if it's simpler and possible to ctrl+F for "featured" and replace with "good" in your existing code, a list of all of them would work great. Ed [talk] [OMT] 20:15, 12 January 2024 (UTC)Reply
Fixing ping Legoktm. Ed [talk] [OMT] 21:23, 12 January 2024 (UTC)Reply
The main thing is to create a list of the shortest and longest, we need to also calculate the sizes of everything in the middle too :) So I did the swap "Featured" for "Good" and copied most of the code, here you go: Wikipedia:Database reports/Good articles by size. The longest are on page 1 and the shortest at the end of page 4. Let me know if this works for you and/or if there's other stuff you want! Legoktm (talk) 03:13, 13 January 2024 (UTC)Reply
@Legoktm: Huh. That just makes too much sense for me to have realized that by myself. :-)) That is perfect! Thanks very much. I appreciate the work and owe you one. Ed [talk] [OMT] 19:18, 13 January 2024 (UTC)Reply
You're welcome! Legoktm (talk) 17:30, 14 January 2024 (UTC)Reply

No automated install?

edit

Any idea why this does not work with the "Install scripts without having to manually edit JavaScript files" gadget? I don't see the blue button for installing or uninstalling this (unlike for most other scripts). Piotrus at Hanyang| reply here 05:05, 17 May 2024 (UTC)Reply

Because it's a gadget. Nardog (talk) 00:49, 18 May 2024 (UTC)Reply
@Nardog So... how can we make it user friendly? Can we convert it into a script? I am teaching my students to use advanced tools, but subjecting them to torture of editing js pages or such is not something I consider ethical :P Piotrus at Hanyang| reply here 07:14, 20 May 2024 (UTC)Reply
As the page says, you can enable it in your preferences directly. I've revised the instructions slightly so hopefully it's clearer now. Nardog (talk) 07:20, 20 May 2024 (UTC)Reply
@Nardog Ah. I admit I was so surprised by the lack of the install button I did not read the text - it is indeed simple enough. But if we could add the blue install button (i.e. make it work with the installation script) it would be eve better for new editors. Piotrus at Hanyang| reply here 23:55, 23 May 2024 (UTC)Reply

Installed, but did not work

edit

I downloaded the script for the WikiProject Guild of Copy Editors Backlog elimination drives May 2024 but didn't appear under my tools section. KjjjKjjj (talk) 23:46, 3 June 2024 (UTC)Reply

Perhaps try on mainspace articles? Open the Tools section, wherever it may be, and you should find it. Apollogetticax|talk 00:10, 2 July 2024 (UTC)Reply
@Apollogetticax: Prosesize doesn't appear in my Tools section even though I've installed it via Preferences. KjjjKjjj (talk) 02:37, 2 July 2024 (UTC)Reply
Oh, sorry, it doesn't say "Prosesize" but "Page size". It can be hard to find, especially if you have many scripts and tools, but keep searching for it, and you should find it. Apollogetticax|talk 02:47, 2 July 2024 (UTC)Reply
@Apollogetticax: If I am not mistaken, it should appear under the Tools section? And if so, I don't see any in my Tools section. KjjjKjjj (talk) 02:49, 2 July 2024 (UTC)Reply
@Apollogetticax: Update: I managed to find the Page size under General. Thanks for helping me out! KjjjKjjj (talk) 14:44, 13 July 2024 (UTC)Reply

Potential bug?

edit

When I was working on some article expansion, I tried using prosesize to determine the amount of readable prose currently in the article's expanded state but it did not work. The tool highlighted the article like it was about to calculate but never showed the actual size of the article. Is this a system-wide bug or am I hallucinating? ❤HistoryTheorist❤ 00:52, 18 August 2024 (UTC)Reply

@HistoryTheorist: Possibly system-wide. It has affected me, too. Mox Eden (talk) 01:03, 18 August 2024 (UTC)Reply
Dang! I really wanted to use that tool. Hope this doesn't go the way of the graph extension in terms of fixing it. ❤HistoryTheorist❤ 01:04, 18 August 2024 (UTC)Reply
https://prosesize.toolforge.org/ is offline. Nardog (talk) 01:04, 18 August 2024 (UTC)Reply
Thanks for the update! If you or anybody else knows when it will go back online, I would also like to know as well. ❤HistoryTheorist❤ 01:44, 18 August 2024 (UTC)Reply
As the gadget is capable of computing the counts locally as well, it should ideally be used as a fallback for situations like these, cc @Galobtter.
@HistoryTheorist In the meantime, the prose size counter within the DYK wizard could be used. Just enter the article name but don't submit the form. – SD0001 (talk) 09:09, 18 August 2024 (UTC)Reply
FWIW, I started copyediting a request before the GOCE blitz. To get a word count for a section to apply to a drive or blitz when Prosesize goes sideways, I copypaste the text into a new LibreOffice Writer document. The word count is at the bottom of the page, which is convenient. All the best, Miniapolis 13:24, 18 August 2024 (UTC)Reply
fixed as described - the gadget should be working now. Galobtter (talk) 20:10, 18 August 2024 (UTC)Reply
Thanks! It's back up and running! ❤HistoryTheorist❤ 21:25, 18 August 2024 (UTC)Reply

Greetings - Again, Gadget highlights, but shows no proze size counts. JoeNMLC (talk) 13:18, 19 June 2025 (UTC)Reply

Now working Ok...maybe just a "blip"? JoeNMLC (talk) 13:28, 19 June 2025 (UTC)Reply

Not working?

edit

When I click the Page Size tool on the sidebar, the prose is highlighted in yellow, but no word count (or other page size info) is shown. What am I doing wrong? Thanks —Of the universe (say hello) 17:06, 18 August 2024 (UTC)Reply

Please see the previous thread. SD0001's Wikipedia:Did you know/Create new nomination works well, even on lists; just remember to click "Preview" (not "Submit" ). All the best, Miniapolis 17:30, 18 August 2024 (UTC)Reply

Prose size (undefined words) for old revisions

edit

Platform = Windows 11
Browser = Firefox 134.0.1
Article = Donald Trump

Works fine for the current revision. In five out of five old revisions I tested (including this one), returns:

  • Prose size (text only): undefined B (undefined words) "readable prose size"

Thank you for your attention. I need this somewhat urgently. Mandruss  03:13, 22 January 2025 (UTC)Reply

Not unique to that article. Old revision of Joe Biden: . Mandruss  19:17, 22 January 2025 (UTC)Reply

Hmm seems to work for me? Does a different browser work? Galobtter (talk) 19:35, 22 January 2025 (UTC)Reply
Fails with Edge. I don't have any other browsers and don't care to install one. Mandruss  21:02, 22 January 2025 (UTC)Reply
I just tried a computer restart, no joy. I considered clearing browser cache, but that wouldn't cause it to fail with Edge. Mandruss  21:08, 22 January 2025 (UTC)Reply
By the way, here's why this is non-trivial for me: Talk:Donald Trump#Tracking article size. As you can see there, I didn't have this problem, or didn't happen to encounter it, between 5 Nov and 14 Jan. Mandruss  21:50, 22 January 2025 (UTC)Reply
I'd appreciate a ping for any further replies. I keep breaking away from the Trump article to check for new replies, only to find none. Mandruss  12:12, 23 January 2025 (UTC)Reply
Found a barely acceptable workaround. Copy old revision wikitext to sandbox, removing categories. Get prose size there. Experience so far is that that fails 75% of the time with the above nonsense, but the remaining 25% is enough to get the job done. The issue is not resolved, just worked around. Mandruss  01:38, 25 January 2025 (UTC)Reply

Big drop in # prose words after remove duplicate spaces!?!?

edit

In the Bridge article, the Page Size tool reported about 9,500 prose words, then this edit was made that removed about 500 duplicate spaces (2 adjacent spaces) and the prose word count dropped to 9,000. That seems like a bug to me. Granted, duplicate spaces are discouraged in WP, but shouldn't the tool return the same count with or without duplicated spaces? Noleander (talk) 21:23, 3 November 2025 (UTC)Reply

@Noleander: thanks for the report, I've fixed it in the tool now. Double spaces or any other excess whitespace won't create extra words but it will still inflate the character count. Legoktm (talk) 03:22, 21 December 2025 (UTC)Reply
Thanks for fixing it, it'll come in handy ... especially for featured articles where they scrutinize the word count. I don't use the character count, so that's not an issue. Noleander (talk) 04:18, 21 December 2025 (UTC)Reply

Bullet points not counted

edit

I have noticed that the script doesn't count text if it is a part of a bullet point/list. Any way to change this? Kingsacrificer (talk) 15:36, 17 December 2025 (UTC)Reply

@Kingsacrificer looking at the source code of this script, the logic to count a page's prose size is very simple, just get every p tag's contents, then for each of those contents run the following: wordCount += this.innerHTML.replace( /(<([^>]+)>)/ig, '' ).split( ' ' ).length;. It should be pretty simple to just change:
134: parserOutput.children( 'p' ).each( function () {... to
134: parserOutput.querySelectorAll('p, li').each( function () {...
but I'm guessing this causes some funkyness with some templates, since all bullet lists are nested in 1 more layer compared to prose, so using querySelectorAll would also select some unwanted collateral. monkeysmashingkeyboards (talk) 01:35, 10 February 2026 (UTC)Reply

Java error resulting from #chart

edit

Savannah River Plant has a chart in it: Plutonium (kg)Fiscal year010002000300040005000600070001947195419611968197519821989Weapon grade (SRS)Weapon grade (Hanford)Fuel grade (Hanford)Hanford and Savannah River Site Plutonium Pr...

{{#chart:Production Plutonium Hanford SRS (1947-1989).chart|data=Production Plutonium Hanford-SRS-1947-1989 (Corrected).tab}}

This causes the Prose Size tool to hang with a Javascript error Uncaught TypeError: id.childNodes[i].className.indexOf is not a function. It points to MediaWiki:Gadget-Prosesize.js#L-76. Hawkeye7 (discuss) 18:50, 18 February 2026 (UTC)Reply