title: Expanding English contractions in, based on a dictionary of most common contractions
body: <p>I'm trying to substitute contracted words using Python, but am facing errors.</p>
  
  <pre><code>import re
  tweet = "I luv my &lt;3 iphone &amp; you're awsm apple. DisplayIsAwesome, sooo happppppy  http://www.apple.com"
  contractions_dict = {"ain't": "am not",
                    "aren't": "are not",
                    "can't": "cannot",
                    "you're": "you are"}    
  
  contractions_re = re.compile('(%s)' '|'.join(contractions_dict.keys()))
  
  def expand_contractions(s, contractions_dict=contractions_dict):
      def replace(match):
          return contractions_dict[match.group(0)]
  
      return contractions_re.sub(replace, s)
  
  expand_contractions(tweet)
  </code></pre>
  
  <p>I've tried adding a "/" in the "you're", didn't work.</p>
  
  <p>The output is supposed to be the expanded version, but instead the original tweet is just passed through.</p>