Admin Forum:Using a bot

I know how to use a bot and all... Just had one question:
 * Is it possible to use a bot to remove all categories from all redirect pages? 13:27, September 5, 2012 (UTC)
 * replace.py maybe, if you can include redirects and filter by page content ("#REDIRECT").--PedroM (talk) 13:52, September 5, 2012 (UTC)
 * Can you elaborate it a bit, please. 13:55, September 5, 2012 (UTC)
 * I am talking pywikipedia. Go through all pages redirects (hey, there is a -redirectonly parameter), replace  \[\[Category:.+\]\]  (you need to set the -regex parameter) with nothing.--PedroM (talk) 14:29, September 5, 2012 (UTC)
 * Well... actually speaking, I am not that very advanced in using a bot. Can you tell me what exactly should I enter in cmd? 14:39, September 5, 2012 (UTC)
 * python replace.py -redirectonly:! -regex '\[\[Category:.+\]\]' '' --PedroM (talk) 15:29, September 5, 2012 (UTC)
 * As it is, right? Thank You very much for your help. 15:35, September 5, 2012 (UTC)
 * I'd modify Pedro's suggestion slightly to:
 * Not everyone capitalises the c in category. By using, you're telling the bot to look for both   and  . You'll find as you use pywikipediabot more that you should almost always do a case-insensitive search like this.
 * Not everyone capitalises the c in category. By using, you're telling the bot to look for both   and  . You'll find as you use pywikipediabot more that you should almost always do a case-insensitive search like this.


 * (How could someone not use a capital C? Doesn't the system automatically use a capital C? Well, yes — but remember that many editors edit in Monobook, where there is no category module which adds categories automatically. And many exclusively use source mode, where manual addition of the category link is the norm. It's quite easy to avoid using capital Cs, actually.) 22:06: Thu 06 Sep 2012
 * Hey Thank You very much. You people look very experienced with bot. I had another question. I want to change all US-spelllings to UK ones like color to colour, realize to realise, etc. So what I was thinking of doing is something like this:

replace.py -ns:0 color colour Color Colour -search:color Is there any easier way of doing it? 05:26, September 7, 2012 (UTC)
 * You could prepare a file where you set up all replacements to be made, then pass that to the script with . Also, you can go through all pages by using   instead of  . Keep in mind that most scripts have a manual about all its parameters available, just run  .--PedroM (talk) 19:01, September 8, 2012 (UTC)
 * Or maybe something like userfixes. Well..the first code (for removing categories) that you gave me doesn't seem to be working. It says, "No changes were necessary at ...." and doesn't make any changes. 16:54, September 13, 2012 (UTC)

Sorry I didn't see this followup question, because I'm a bit of a British spellchecking geek. What you need is the SpellBot I created at tardis. You can see the complete code at this page.

Basically, you must create a userfix if you're serious about British spellchecking. Using the file method PedroM suggested won't, in my experience, work. Neither will your method of searching for each individual word and changing it. There are simply too many variations, given that sometimes colour begins a sentence, so it needs to be capitalised, and sometimes it doesn't. Also, you've got colourisation, colours, coloured, recoloured, uncoloured, and on and on. Just think of how many words employ the root of metre and litre. But you can't go crazy correcting for metre, because meter is acceptable in BrEng when you're talking about a guage of some kind — tachometre is wrong. So how do you change one but not the other? And what if you have someone like Honor Blackman? How do you spellcheck for honour, generally, but leave Honor Blackman alone? That simply can't be done with the file method — or at least not very easily or elegantly. To have any hope at all of British spellchecking your site, you must employ a regex solution. The most flexible regex is available through user-fixes, not files.

If you are not committed to changing all the words, there's no point in starting. I mean it. You're making your wiki worse if you only correct for organise, but not organisation, organised, reorganised, reorganisation, unorganised, disorganisation, and unorganised. And if you can't figure out how to make exceptions, you're dead in the water.

If you've just gotten awfully depressed because you didn't realise what a big job it all was, don't reach for the alcohol just yet. SpellBot 1.0 corrects for thousands of words at once and it makes useful exceptions and it recognises when a word needs to be capitalised. Feel free to copy it into your user-fixes.py file. To activate, type python replace.py -fix:spelling -start:!

You will probably need to change the words you see in the "exceptions" area, because those exceptions are very specific to my wiki.

Also, bear in mind that you can't run SpellBot automatically. Don't, in other words, hit the "all" option and walk away from your computer. Obviously, there are some words, like practice andlicense which are also correctly spelled practise and licence in Britain. The only way you can tell if the spelling is correct is by reading the context of the sentence, so you have to individually approve every change.

On my wiki, which had about 27k articles at the time, it took about a week of trudging through every page individually. After that initial run, however, it's only taken a few hours for each subsequent, periodic cleanup.

There are also a number of sort of "philosophical" issues you have to consider when dealing with SpellBot. You'll want to read the notes in the early sections of the page that explains SpellBot if you're not that familiar with the trans-Atlantic and intra-British spelling issues that await you in your quest to British spellcheck wikis that are hosted by an American company like Wikia.

Oh, and don't forget, too, that a number of MediaWiki messages must be changed if you're really serious about Anglicisation. For a start, this toolbar down at the bottom of the page says "Customize" on this wiki —but not at tardis.

If you need any help with any of this, please contact me directly. as I don't check w:c:community every day. 03:55: Mon 17 Sep 2012