title: How to efficiently use spell correction for a large text corpus in Python
body: <p>Consider the following for spell-correction:</p>
  <pre><code>from autocorrect import spell
  import re
  
  WORD = re.compile(r'\w+')
  def reTokenize(doc):
      tokens = WORD.findall(doc)
      return tokens
  
  text = [&quot;Hi, welcmoe to speling.&quot;,&quot;This is jsut an exapmle, but cosnider a veri big coprus.&quot;]
  def spell_correct(text):
      sptext = []
      for doc in text:
          sptext.append(' '.join([spell(w).lower() for w in reTokenize(doc)]))      
      return sptext    
  
  print(spell_correct(text)) 
  </code></pre>
  <p>Here is the output for above piece of code:</p>
  <p><a href="https://i.stack.imgur.com/QQ6eV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QQ6eV.png" alt="enter image description here" /></a></p>
  <p>How I can stop displaying the output in jupyter notebook? Particularly if we have a large number of text documents, it will be lots of outputs.</p>
  <p>My second question is: how can I improve the speed and accuracy (please check the word &quot;veri&quot; in the output for example) of the code when applying on a large data? Is there any better way to do this? I appreciate your response and (alternative) solutions with better speed.</p>