Tardis:What SpellBot actually corrects

Because even the most conscientious of editors will occasionally make spelling errors, there is a need to have bot enforcement of the spelling policy. A comprehensive list of the differences between British and American spellings has been compiled, and is being coded for bot use as of the second week of June, 2011. This page will see heavy updating throughout that week as the list is fully coded.

Following is the raw code of the bot routine (known as a "user-fix"), so that all users may see what exactly the bot is checking for.

Words the bot will not check for
Some words are beyond the capability of the bot, because they are valid spellings (even if of different words) in British English. This list includes:
 * Check. Americans use this word to mean not only a verb meaning to investigate, but also a the noun, which is a financial instrument.  Because the first meaning is valid in BrEng, the bot can't be program to correct the other usage.  We'd end up with sentences like:
 * The Doctor chequed on Sarah Jane in her hospital room before going to the pathology lab.


 * Tire. Both sides of the Atlantic use tire as a verb.  It's again the noun that's problematic.  Americans view tire as the correct spelling for what the British would call a tyre.  The bot can't figure this one out, so it doesn't even try.
 * Draft. Americans use this spelling for all senses, the British use both for different senses.  All words beginning with drafts will be converted to draughts-, and the word drafty will be converted to draughty, but the word draft itself won't be touched by the bot, as that is a valid British spelling of the word.  Clear as mud?  Cool.  Onwards, then . ..
 * Judgment. There's no agreement on either side of the Atlantic whether this word should be judgment or judgement.  Oddly, most British spell-checkers will red-flag judgment, even though that's the official spelling in Commonwealth courts.  We have at least one story title preferencing the version with two es — Judgement of the Judoon.  But still, this word will require a special forum discussion to decide which way we want to spell it.
 * Disc. Way, way, way too screwed up a word for a simple bot to handle.  Disc jockey is fine on both sides of the divide, but so is floppy disk and hard disk. This one simply depends on context.
 * Connexion. This British spelling of connection is not universally used in Britain. Connection is correct in Britain, too, so the bot won't try to force connection into a connexion-shaped hole.
 * Simidgen, smidgeon, smidgin. They're all valid spellings for the same word, on both sides of the Atlantic.  The only way the bot could be useful is if we had a forum discussion to settle on one of the three spellings.
 * Practise. The -ise version of this word is the correct spelling for the verb in BrEng; the British noun ends in -ice.  Americans use -ice for everything.  Thus, the bot can't be of much use, except for participles derived from the verb.  So, the bot will make no attempt to change the spelling of practice, but it will change practicing and practiced to practising and practised.
 * Jail. Yes, gaol is still correct, especially historically, but jail has largely supplanted it.  So we won't look to correct jail to gaol, but neither will we try to correct gaol to jail.
 * Yogurt passes most British spell-checkers today, but so does yoghurt. We'll leave both well alone until a forum discussion decides the matter.
 * Almanac is universally the way it's spelt in American English, and increasingly the way Britons spell it, too. Still, some old-timers will go for almanack. Until a forum discussion decides otherwise, the bot won't enforce either spelling.
 * Gasses/gases. Both spellings are correct on both sides of the Atlantic.  The bot won't correct for either until a forum discussion settles on a particular spelling.
 * Programme/program. Both spellings pass British spell-checkers, even though there's a perception that "programme" is Britsh and "program" is American.  Until there's a community decision on spelling, the bot won't touch either spelling.
 * Groin. Groyne is so archaic, modern British spell-checkers usually fail it.  For that reason, the bot will actively correct groyne to groin.
 * Griffin/Gryphon. Both pass British spell-checkers, so it'll take a forum discussion to decide which way we want to go.
 * Inflexion is the way the British have historically spelt inflection, but modern British spell-checkers pass both spellings. So, the bot won't enforce either.
 * Instal/install. Modern British spell-checkers are cool with both, so the bot is, too. But the proper British spelling is instalment, not installment.

How to read the code
The code works by telling the bot to look for the word described before the comma. Then it replaces it with the word after the comma. A most basic expression would be:
 * {u'color',u'colour')

This looks for the American "color", then replaces it with the British "colour".

Because typing every permutation of a word, including all words that share the same root and capitalised variants, would be very time-consuming, most of the code won't work in such a simplistic way. Most of it uses a "regular expression" — or regex — to find a lot of hits with just one line. Here's an explanation of the regex used in this code:
 * The expression ([Cc]) means "look for either capitalised or lowercase versions of the letter C
 * (.?) means, "You, Mr. Fancy Computer bot thing, might find some more letters to the right of this point. Grab 'em all up to the next space only."
 * /1 means, "take whatever is in the first parentheses and put it here"
 * /2 means, "take whatever is in the second parentheses and put it here"

Thus, if we have the expression,
 * (r'([Cc])apitaliz(.?)', r'\1capitalis\2')

It means, roughly,
 * Look for all words, beginning with either a capital or lowercase C, which are followed by the letters "apitaliz" + any other letters you find until the next space. Then, keep the form of the letter c that you find, stick on "apitalis", and add back in any letters you orginally found after the "z".

In other words, find, Capitaliz-, keep the C capitalised, switch the z to an s, then stick on "-e', "-ing", "-ed", or "-ation", as appropriate.

The most complicated case
Now let's take a look at arguably the most complicated coding here. What if I wanted to change every word that had favor as a root? How could I take care of words that had both a prefix and a suffix, like disfavorable? Putting together everything we've learned so far, it would be:
 * (r'(.?)([Ff])avor(.?)',r'\1\2avour\3')

The leading (.?) means check to see if there's a prefix. The ([Ff]) switch checks for capitalisation of the root letter f. The (.?) at the end checks for suffixes. Now we have three parentheses instead of just two. So \1 means the prefix, \2 puts the letter f in with proper capitalisation, and \3 adds any suffixes.

This one statement will therefore switch over: favor, favors, favored, disfavor, disfavored, unfavorable, favoring, disfavoring, favorable, and almost certainly a few more.

Cases where regex fails
Not every word on our list has been switched using regex expressions. Sometimes it's easier just to type up a switch of literal characters, as when a word serves as the root of no other words.

The code
The following code will change over time, as more words are added. The final word in the English language that has a British/American difference is yodelling. Once you see that word on this list, you'll know the bot is fully programmed. fixes['spelling'] = { 'regex': True, 'recursive': True, 'msg': { 'en':u'Enforcing spelling policy.' },   'replacements': [ (r'([Aa])ccessoriz(.?)', r'\1ccessoris\2'), (r'([Aa])cclimitiz(.?)',r'\1cclimatis\2'), (r'([Aa])ccouterments',r'\1ccoutrements'), (r'( +)eon( +)',r'\1aeon\2'), (r'( +)eons( +)',r'\1aeons\2'), (r'([Aa])erogram( +)',r'\1erogramme\2'), (r'([Aa])erograms',r'\1erogrammes'), (r'( +)esthete(.?)( +)',r'\1aesthete\2\3'), (r'( +)esthetic(.?)( +)',r'\1aesthetic\2\3'), (u'( +)etiology',u'\1aetiology'), (r'(.?)aging',r'\1ageing'), (r'([Aa])ggrandizement',r'\1ggrandisement'), (r'([Aa])goniz(.?)', r'\1gonis\2'), (r'([Aa])luminum', r'\1luminium'), (r'([Aa])mortize( +)',r'\1mortise\2'), (r'([Aa])mortiz(.?)',r'\1mortis\2'), (r'([Aa])ampitheater( +)',r'\1mphitheatre\2'), (r'([Aa])mpitheaters',r'\1mphitheatres'), (r'([Aa])mphitheater( +)',r'\1mphitheatre\2'), (r'([Aa])mphitheaters',r'\1mphiteatres'), (r'([Aa])nemi(.?)',r'\1naemi\2'), (r'([Aa])nesthesia',r'\1naesthesia'), (r'([Aa])nestheti(.?)',r'\1naestheti\2'), (r'([Aa])nalog( +)',r'\1nalogue\2'), (r'([Aa])nalogs',r'\1nalogues'), (r'([Aa])nalyze( +)',r'\1nalyse\2'), (r'([Aa])nalyz(.?)',r'\1nalys\2'), (r'([Aa])ngliciz(.?)',r'\1nglicis\2'), (r'([Aa])nnualized',r'\1nnualised'), (r'([Aa])ntagoniz(.?)',r'\1ntagonis\2'), (r'([Aa])pologiz(.?)',r'\1pologis\2'), (u'appall',u'appal'), (u'appalls',u'appals'), (r'([Aa])ppetiz(.?)',r'\1ppetis\2'), (r'([Aa])rbor(.?)',r'\1rbour\2'), (r'([Aa])rcheolog(.?)',r'\1rchaeolog\2'), (u'ardor',u'ardour'), (r'([Aa])rmor(.?)',r'\1rmour\2'), (r'([Aa])rtifact(.?)',r'\1rtefact\2'), (r'([Aa])uthoriz(.?)',r'\1uthoris\2'), (r'([Aa])x( +)',r'\1xe\2'), (r'([Bb])ackpedaled', r'\1ackpedalled'), (r'([Bb])ackpedaling', r'\1ackpedalling'), (r'([Bb])anister(.?)', r'\1annister\2'), (r'([Bb])aptiz(.?)',r'\1aptis\2'), (r'([Bb])astardiz(.?)',r'\1astardis\2'), (r'(Bb)attleax( +)',r'\1attleaxe\2'), (r'(Bb)alk(.?)',r'\1aulk\2'), (r'(Bb)edeviled',r'\1edevilled'), (r'(Bb)edevling',r'\1edevilling'), (r'(Bb)ehavior(.?)',r'(\1ehaviour\2'),       (r'(Bb)ehoove(.?)',r'\1ehove\2'),        (r'(Bb)ejeweled',r'\1ejewelled'),        (r'(.?)([Ll])abor(.?)',r'\1\2abour\3'),        (r'([Bb])eveled',r'\1evelled'),        (r'([Bb])evies',r'\1evvies'),        (r'([Bb])evy',r'\1evvy'),        (r'([Bb])iased',r'\1iassed'),        (r'([Bb])iasing',r'\1iassing'),        (r'([Bb])inging',r'\1ingeing'),        (r'([Bb])ougainvillea(.?)',r'\1ougainvillaea\2'),        (r'([Bb])owdleriz(.?)',r'\1owdleris\2'),        (r'([Bb])reathalyz(.?)',r'\1reathalys\2'),        (r'([Bb])rutaliz(.?)',r'\1rutalis\2'),        (r'([Bb])usses',r'\1uses'),        (r'([Bb])ussing',r'\1using'),        (r'([Cc])esarean(.?)',r'\1aesarean\2'),        (r'([Cc])aliber(.?)',r'\1alibre\2'),        (r'([Cc])aliper(.?)',r'\1calliper\2'),        (r'([Cc])alisthenics',r'\1allisthenics'),        (r'([Cc])analiz(.?)',r'\1analis\2'), (r'([Cc])ancelation',r'\1ancellation'), (r'([Cc])ancelations',r'\1ancellations'), (r'([Cc])anceled',r'\1ancelled'), (r'([Cc])anceling',r'\1ancelling'), (r'([Cc])andor',r'\1andour'), (r'([Cc])annibaliz(.?)',r'\1annibalis\2'), (r'([Cc])anibaliz(.?)',r'\1annibalisi\2'), (r'([Cc])anibalis(.?)',r'\1annibalis\2'), (r'([Cc])anoniz(.?)',r'\1anonis\2'), (r'([Cc])apitaliz(.?)',r'\1apitalis\2'), (r'([Cc])arameliz(.?)',r'\1aramelis\2'), (r'([Cc])arboniz(.?)',r'\1arbonis\2'), (r'([Cc])aroled',r'\1arolled'), (r'([Cc])aroling',r'\1arolling'), (r'([Cc])atalog( +)',r'\1atalogue\1'), (r'([Cc])atalogs( +)',r'\1atalogues\2'), (r'([Cc])ataloged',r'\1atalogued'), (r'([Cc])ataloging',r'\1ataloguing'), (r'([Cc])atalyz(.?)',r'\1atalys\2'), (r'([Cc])ategoriz(.?)',r'\1ategoris\2'), (r'([Cc])auteriz(.?)',r'\1auteris\2'), (r'([Cc])avilled',r'\1avilled'), (r'([Cc])aviling',r'\1avilling'), (r'(.?)([Gg])ram( +)',r'\1gramme\2'), (r'(.?)([Gg])rams',r'\1grammes'), (r'([Cc])entiliter(.?)',r'\1entilitre\2'), (r'([Cc])entimeter(.?)',r'\1entimetre\2'), (r'([Cc])entraliz(.?)',r'\1entralis\2'), (r'(.?)([Cc])enter(.?)',r'\1\2entre\3'), (r'([Cc])hanneled',r'\1hannelled'), (r'([Cc])hanneling',r'\1hannelling'), (r'([Cc])haracteriz(.?)',r'\1haracteris\2'), (r'([Cc])heckbook(.?)',r'\1hequebook\2'), (r'([Cc])hili',r'\1hilli'), (r'([Cc])himera(.?)',r'\1himaera\2'), (r'([Cc])hiseled',r'\1hiselled'), (r'([Cc])hiseling',r'\1hiselling'), (r'([Cc])irculariz(.?)',r'\1ircularis\2'), (r'([Cc])iviliz(.?)',r'\1ivilis\2'), (r'([Cc])lamor(.?)',r'\1lamour\2'), (r'([Cc])langor',r'\1langour'), (r'([Cc])larinetist',r'\1larinettist'), (r'([Cc])ollectiviz(.?)',r'\1ollectivis\2'), (r'([Cc])oloniz(.?)',r'\1olonis\2'), (r'(.?)([Cc])olor(.?)',r'\1\2olour\3'), (r'([Cc])ommercializ(.?)',r'\1ommercialis\2'), (r'([Cc])ompartmentaliz(.?)',r'\1ompartmentalis\2'), (r'([Cc])omputeriz(.?)',r'\1omputeris\2'), (r'([Cc])onceptualiz(.?)',r'\1onceptualis\2'), (r'([Cc])ontextualize(.?)',r'\1ontextualis\2'), (r'([Cc])oz(.?)',r'\1os\2'), (r'([Cc])ouncilor(.?)',r'\1ouncillor\2'), (r'([Cc])ounselor(.?)',r'\1ounsellor\2'), (r'([Cc])ounseling',r'\1ounselling'), (r'([Cc])ounseled',r'\1ounselled'), (r'([Cc])renelated',r'\1renellated'), (r'([Cc])riminaliz(.?)',r'\1riminialis\2'), (r'([Cc])riticiz(.?)',r'\1riticis\2'), (r'([Cc])rueler',r'\1rueller'), (r'([Cc])ruelest',r'\1ruellest'), (r'([Cc])rystalliz',r'\1rystallis\2'), (r'([Cc])udgeled', r'\1udgelled'), (r'([Cc])udgeling',r'\1udgelling'), (r'([Cc])ustomiz(.?)',r'\1ustomis\2'), (r'([Cc])ipher(.?)',r'\1ypher\2'), (r'([Dd])ecentraliz(.?)',r'\1ecentralis\2'), (r'([Dd])ecriminaliz(.?)',r'\1ecriminalis\2'), (r'([Dd])efense(.?)',r'\1efence\2'), (r'(.?)([H,h])umaniz(.?)',r'\1\2umanis\3'), (r'([Dd])emeanor',r'\1emeanour'), (r'(.?)([Mm])ilitariz(.?)',r'\1\2ilitaris\3'), (r'(.?)([Mm])obiliz(.?)',r'\1\2obilis\3'), (r'([Dd])emocratiz(.?)',r'\1emocratis(.?)'), (r'([Dd])emoniz(.?)',r'\1emonis(.?)'), (r'(.?)([Mm])oraliz(.?)',r'\1\2oralis\3'), (r'(.?)([Nn])ationaliz(.?)',r'\1\2ationalis\3'), (r'([Dd])eodoriz(.?)',r'\1eodoris\2'), (r'(.?)([Pp])ersonaliz(.?)',r'\1\2ersonalis\3'), (r'([Dd])eputiz(.?)',r'\1eputis\2'), (r'(.?)([Ss])ensitiz(.?)',r'\1\2ensitis\3'), (r'(.?)([Ss])tabliz(.?)',r'\1\2tablis\3'), (r'([Dd])ialed',r'\1ialled'), (r'([Dd])ialing',r'\1ialling'), (r'([Dd])ialog( +)',r'\1ialogue\2'), (r'([Dd])ialogs( +)',r'\1ialogues\2'), (r'([Dd])iarrhea',r'\1iarrhoea'), (r'([Dd])igitiz(.?)',r'\1igitis\2'), (r'([Dd])isemboweled',r'\1isembowelled'), (r'([Dd])isemboweling',r'\1isembowelling'), (r'(.?)([Ff])avor(.?)',r'\1\2avour\3'), (r'([D,d])isheveled',r'\1ishevelled'), (r'(.?)([Hh])onor(.?)',r'\1\2\onour\3'), (r'(.?)([Oo])rganization(.?)',r'\1\2rganisation\3'), (r'([Dd])istil( +)',r'\1istill\2'), (r'([Dd])istils',r'\1istills'), (r'([Dd])ramatiz(.?)',r'\1ramatis\2'), (r'([Dd])rafts(.?)',r'\1raughts\2'), (r'([Dd])rafty',r'\1raughty'), (r'([Dd])rafti(.?)',r'\1raughti\2'), (r'([Dd])riveled',r'\1rivelled'), (r'([Dd])riveling',r'\1rivelling'), (r'([Dd])ueled',r'\1uelled'), (r'([Dd])ueling',r'\1uelling'), (r'([Ee])conomiz(.?)',r'\1conomis'), (r'([Ee])dema',r'\1doema'), (r'([Ee])ditorializ(.?)',r'\1ditorialis\2'), (r'([Ee])mpathiz(.?)',r'\1mpathis\2'), (r'([Ee])nameled',r'\1namelled'), (r'([Ee])nameling',r'\1namelling'), (r'([Ee])namor(.?)',r'\1namour\2'), (r'([Ee])ncyclopedi(.?)',r'\1ncyclopaedi\2'), (r'([Ee])ndeavor(.?)',r'\1ndeavour\2'), (r'(.?)([Ee])nergiz(.?)',r'\1\2nergis\3'), (r'([Ee])nroll(.?)',r'\1nrol\2'), (r'([Ee])nthrall(.?)',r'\1nthral\2'), (r'([Ee])paulet( +)',r'\1paulette\2'), (r'([Ee])paulets',r'\1paulettes'), (r'([Ee])pilog( +)',r'\1pilogue'), (r'([Ee])pilogs',r'\1pilogues'), (r'([Ee])pitomiz(.?)',r'\1pitomis\2'), (r'([Ee])qualiz(.?)',r'\1qualis\2'), (r'([Ee])ulogiz(.?)',r'\1ulogis\2'), (r'([Ee])vangeliz(.?)',r'\1vangelis\2'), (r'([Ee])xorciz(.?)',r'\1xorcis\2'), (r'([Ee])xtemporiz(.?)',r'\1xtemporis\2'), (r'([Ee])xternaliz(.?)',r'\1xternalis\2'), (r'([Ff])actoriz(.?)',r'\1actoris\2'), (r'([Ff])eces',r'\1aeces'), (r'([Ff])ecal',r'\1aecal'), (r'([Ff])amiliariz(.?)',r'\1amiliaris\2'), (r'([Ff])antasiz(.?)',r'\1antasis\2'), (r'([Ff])eminiz(.?)',r'\1eminis\2'), (r'([Ff])ertiliz(.?)',r'\1ertilis\2'), (r'([Ff])ervor',r'\1ervor'), (r'([Ff])iber(.?)',r'\1ibre\2'), (r'([Ff])ictionaliz(.?)',r'\1ictionalis\2'), (r'([Ff])ilet(.?)',r'\1illet\2'), (r'([Ff])inaliz(.?)',r'\1inalis\2'), (r'(.?)([Ff])lavor(.?)',r'\1\2\lavour\3'), (r'([Ff])etal',r'\1oetal'), (r'([Ff])etus(.?)',r'\1oetus\2'), (r'([Ff])etid',r'\1oetid'), (r'([Ff])ormaliz(.?)',r'\1ormalis\2'), (r'([Ff])ossiliz(.?)',r'\1ossilis\2'), (r'([Ff])raterniz(.?)',r'\1raternis\2'), (r'([Ff])ulfill( +)',r'\1ulfil\2'), (r'([Ff])ulfillment',r'\1ulfilment'), (r'([Ff])unnelled',r'\1unneled'), (r'([Ff])unnelling',r'\1unneling'), (r'([Gg])alvaniz(.?)',r'\1alvanis\2'), (r'([Gg])amboled',r'\1ambolled'), (r'([Gg])amboling',r'\1amboling'), (r'([Gg])eneraliz(.?)',r'\1eneralis\2'), (r'([Gg])hettoiz(.?)',r'\1hettois\2'), (r'([Gg])lamoriz(.?)',r'\1lamoris\2'), (r'([Gg])lamor( +)',r'\1lamour\2'), (r'([Gg])lobaliz(.?)',r'\1lobalis\2'), (r'([Gg])luing',r'\1ueing'), (r'([Gg])oiter(.?)',r'\1oitre\2'), (r'([Gg])onorrhea',r'\1onorrhoea'), (r'([Gg])raveled',r'\1ravelled'), (r'([Gg])ray( +)',r'\1rey\2'), (r'([Gg])ray(.?)',r'\1rey\2'), (r'([Gg])roveled',r'\1rovelled'), (r'([Gg])roveling',r'\1rovelling'), (r'([Gg])royne(.?)',r'\1roin\2'), (r'([Gg])rueling(.?)',r'\1ruelling\2'), (r'([Gg])ynacol(.?)',r'\1ynaecol\2'),

],   'exceptions': { 'inside-tags': [ 'pre', 'code', 'nowiki', 'hyperlink', 'link', 'comment', ]       }    }