title: "Spell check" and return the corrected term in Python
body: <p>I recently extracted text data from a directory of pdf files. When reading pdfs, sometimes the text returned is a little messy.</p>
  
  <p>For example, I can be looking at a string that says:</p>
  
  <blockquote>
    <p>"T he administrati on is doing bad things, and not fulfilling what it
    prom ised"</p>
  </blockquote>
  
  <p>I want the result to be:</p>
  
  <blockquote>
    <p>"The administration is doing bad things, and not fulfilling what it
    promised"</p>
  </blockquote>
  
  <p>I tested code (using pyenchant and wx) I found on stackoverflow <a href="https://stackoverflow.com/questions/31026394/how-to-correct-text-and-return-the-corrected-text-automatically-with-pyenchant">here</a> and it did not return what I wanted. My modifications were as follows:</p>
  
  <pre><code>a = "T he administrati on is doing bad things, and not fulfilling what it prom ised"
  chkr = enchant.checker.SpellChecker("en_US")
  chkr.set_text(a)
  for err in chkr:
      sug = err.suggest()[0]
      err.replace(sug)
  
  c = chkr.get_text()#returns corrected text
  print(c)
  </code></pre>
  
  <p>This code returns:</p>
  
  <blockquote>
    <p>"T he administrate on is doing bad things, and not fulfilling what it
    prom side"</p>
  </blockquote>
  
  <p>I'm using Python 3.5.x on a Windows 7 Enterprise, 64-bit. I would appreciate any suggestions!</p>