I Before E, Except After C - Not a rule, but a joke

When I was in high school, I always had fun finding exceptions the "I before e, except after c" rule. I found over a hundred on my own back then just by searching around the Internet. It took me hours. Today I decided to take a better approach and wrote up a small script in to do the work for me. All in all, it found 533 exceptions to this rule.

Click here to view the list of exceptions.

Yeah, that's quite a few. If you're interested in how I did it, continue reading. Don't worry, I won't be sad if you came here just for the list.

The Rule, Broken Down

  1. If the word contains "ei", it must be in the form of "cei" or make a long-A sound.
  2. If the word contains "ie", it cannot be in the form of a "cie".

The Tools Used

  1. The Python Programming Language
  2. Regular Expressions
  3. A file containing all English words [ get here ]

The Code

Writing up the code is pretty simple. Basically all it does is open the dictionary file and check each word against the rule. If it doesn't follow the rule, it logs it in the output file.

import re
 
# Open the input & output file streams
input_handle = file("dictionary.txt", "r")
output_handle = file("i_before_e.txt", "w")
 
# Regexes for removal of valid
bad_ei_regexes = [
 
      # Valid case by default
      re.compile('cei'), 
 
      # Valid case with a long-A sound
      re.compile('^(z|p)ei'),
      re.compile('(?<!--c|s)hei'),
      re.compile('rein'),
      re.compile('vei[nl]'),
      re.compile('eig(h|n|e)')
]
 
# Iterate through all English words
for line in input_handle:
 
    # I comes before e, even when after a c
    if(line.find('cie') != -1):
        output_handle.write(line)
        continue
 
    # Remove all of the long-A sounds
    for regexc in bad_ei_regexes:
        line = regexc.sub('', line)
 
    # E comes before I, without a C, and without long-A sound
    if(line.find('ei') != -1):
        output_handle.write(line)
 
# We're done with the files
input_handle.close()
output_handle.close()

Pretty simple, eh? We let Python and regular expressions do all of the work!

Bonus: Words that have Qs that aren't followed by Us

Scrabble players rejoice! I just compiled a list of words that contain a Q that isn't followed by a U. I did it in the same way that I found exceptions to the "I before E, except after C" rule. This was just for fun. I don't even play Scrabble.

Click here to view the list. (There are 29 words total)

 

 

7 Comments

  1. Drewu wrote,

    Hey man, nice script :) You planning on including the "eigh" in it also?

  2. Evan wrote,

    Hey, Drew! Long time, no see. And yep, I just updated it - thanks for that. :)

    I also made sure to filter out other parts that cause the long-A sound.

  3. Drewu wrote,

    Better. I think there is a final step to this though :P What percentage of words that have ie or ei follow the rule? This would be the true validator of the rule's accuracy :)

  4. Evan wrote,

    Ah, so that we can compare the number of invalid words to the number of valid words?

  5. Drewu wrote,

    Indeed. A simple word count would probably do it. Thought about doing it myself :P

  6. Alysse wrote,

    This is brilliant! I love it!

  7. over9000 wrote,

    Your tarring my MIND APART EVAN!! I can't even remember how to spell face hole words right anymore! God no; it's like your some sort of evil elder god from beyond!

Leave a comment

Take Albuterol Cheap
Inhaler Buying Albuterol
Drug Buying Albuterol
Order Cheapest Albuterol
Order Albuterol Free Delivery
Buying Without Prescription Aldactone
Buy Generic Aldactone
Order Aldactone Next Day Delivery
Purchase Aldactone Online no Prescription
Buy Tablets Aldactone
Take no Prescription Allopurinol
Purchase Allopurinol Drug
When to Take Allopurinol
Order Allopurinol Free Delivery
Pills Buying Allopurinol
Drug Buying Anafranil
Alternative Purchase Anafranil
Purchase Anafranil Drug
Buy Tablets Anafranil Online
Order no Prescription Anafranil
Pills Buying Atarax
Cheapest Order Atarax
Buying Without a Prescription Atarax Online
Buy Atarax Medication
Atarax 50
Avodart Finasteride
Take Avodart Legally
Purchase Avodart by Phone
Tablets Purchase Avodart
Why Take Avodart
Order Bactrim Generic
Buy Without a Prescription Bactrim
Take Bactrim Next Day Delivery
Buying Bactrim Overnight Delivery
Take Bactrim Medication
Why Take Celecoxib
Order Celecoxib Free Delivery
Order Celecoxib Next Day Delivery
Buy Cheap Celecoxib
Purchase no Prescription Celecoxib
Cheapest Buying Cipro
Order Cipro Free Delivery
Buy Without a Prescription Cipro
Buy Cipro Tablets
Purchase Cipro Free Delivery
Order Clomid Serophene Without a Prescription
Order Clomid Serophene Medication
Online Order Clomid Serophene Without Prescription
Buy Clomid Serophene Medication
Purchase Cheap Clomid Serophene
Buy Dapsone Without a Prescription
Alternative Order Dapsone
Buy Dapsone by Phone
Buy Dapsone Overnight Delivery
Buy Dapsone Tablets
Buy Desyrel Online no Prescription
Purchase Desyrel Next Day Delivery
Order Desyrel Free Delivery
Buy Desyrel Next Day Delivery
Purchase Cheapest Desyrel
Take Diflucan Medication
Purchase Diflucan Free Delivery
Tablets Buying Diflucan
Buy Diflucan Pills
Order Cheap Diflucan
Alternative Purchase Dilantin
Buying Without a Prescription Dilantin Online
Buy no Prescription Dilantin Online
Purchase no Prescription Dilantin
Cheapest Order Dilantin
Buy Tablets Diovan
Buy Diovan Free Delivery
Purchase Diovan Generic
Buying Pills Diovan
Buying Without a Prescription Diovan Online
Generic Order Doxycycline
Buy Tablets Doxycycline
Buy Doxycycline Overnight Delivery
Buy Tablets Doxycycline Online
Purchase Pills Doxycycline
Drug Order Elavil
Buy Elavil Overnight Delivery
Buy Elavil Without a Prescription
Take Elavil Legally
Buy Alternative Elavil
Purchase Online Without a Prescription Erythromycin
Purchase Erythromycin Without a Prescription
Generic Order Erythromycin
Pills Buying Erythromycin
Purchase Cheapest Erythromycin
Take Estrace Free Delivery
Pills Buying Estrace
Generic Buying Estrace
Purchase Online no Prescription Estrace
Order Estrace by Phone
Buy Furosemide Medication
Generic Buying Furosemide
Buying Furosemide On-Line
Buy Without a Prescription Furosemide
Take Furosemide Drug
Take Glucophage Next Day Delivery
Tablets Purchase Glucophage
Order Pills Glucophage
Order Glucophage Generic
Order Cheapest Glucophage
Purchase Imitrex Online no Prescription
Take Imitrex Without Prescription
Order Imitrex Medication
Buy Cheap Imitrex
Online Order Imitrex Without Prescription
Buy no Prescription Inderal
Pills Buying Inderal
Order Inderal Without a Prescription
Buying Inderal On-Line
Order Inderal Medication
Lasix 40
Buying Lasix On-Line
Buy Lasix no Prescription
Order Online Without a Prescription Lasix
Buy Lasix Generic
Take Levaquin Drug
Order Levaquin Pills
Buy Tablets Levaquin
Buying Without Prescription Levaquin
Purchase Cheapest Levaquin
Take Lexapro Daily Dose
Order Pills Lexapro
Take Lexapro Legally
Take Lexapro Drug
Purchase Generic Lexapro
Order Lipitor COD
Buy Pills Lipitor
Purchase Online Without a Prescription Lipitor
Lipitor Lipidor
Buy Cheapest Lipitor
Purchase Generic Lisinopril
Buy Lisinopril Tablets
Generic Buying Lisinopril
Purchase Lisinopril Online Without Prescription
Purchase Lisinopril Medication
Purchase Methotrexate Medication
Take Methotrexate Pills
Order Methotrexate Generic
Order Methotrexate Without a Prescription
Buy Tablets Methotrexate Online
Order Nizoral Pills
Order Nizoral Free Delivery
Order Nizoral no Prescription
Pills Buying Nizoral
Buy no Prescription Nizoral Online
Buy Nolvadex Cheapest
Alternative Order Nolvadex
Buying Nolvadex Free Delivery
Purchase Nolvadex COD
Alternative Purchase Nolvadex
Online Order Nortriptyline Without Prescription
Buying Without Prescription Nortriptyline
Purchase no Prescription Nortriptyline
Purchase Nortriptyline Online Without Prescription
Purchase Nortriptyline by Phone
Alternative Purchase Ortho Tri-Cyclen
Buy Ortho Tri-Cyclen Medication
Buying Ortho Tri-Cyclen Next Day Delivery
Online Buy Ortho Tri-Cyclen Without a Prescription
Purchase Ortho Tri-Cyclen Generic
Buy Tablets Premarin
Order Premarin Generic
Order Premarin Free Delivery
Purchase Pills Premarin
Purchase Premarin Next Day Delivery
When to Take Proscar
Order Proscar Free Delivery
Take Proscar Free Delivery
Cheapest Buy Proscar
Purchase Proscar Next Day Delivery
Online Order Risperdal Without Prescription
Buy Risperdal Without a Prescription
Generic Order Risperdal
Buying Risperdal Next Day Delivery
Buy Online Without a Prescription Risperdal
Buying Synthroid Without Prescription
Alternative Buying Synthroid
Order Synthroid by Phone
Buy Alternative Synthroid
Buy Online Without a Prescription Synthroid
Order Topamax Pills
Tablets Order Topamax
Order Cheap Topamax
Order Topamax Generic
Take Topamax Daily Dose
Purchase Valtrex COD
Buy no Prescription Valtrex
Buy Pills Valtrex Online
Tablets Buy Valtrex
Buy Valtrex COD
Legally Order Zithromax
Tablets Order Zithromax
Buy Without a Prescription Zithromax
Buying Without a Prescription Zithromax Online
Purchase Zithromax Without a Prescription