Spell corrector not working properly in Python -


i have problem autocorrect module, in particular function spell(word): here there's class use

class spellcorrector(preprocessmodule):      def process(self, text):         result = ""         word in text.split():             result = result + spell(word) + " "          return result 

the test is:

st = "ehi thia ia beautiful dau"     w in st.split():         print(spellcorrector.process(w)) 

and output is:

"eh thia ia beautiful dau" 

so, seems not work well, , remarkably slow.

for of have used module "autocorrect" in python, normal? forgetting something? suggestion on other spell checkers?

thanks in advance

what recommend use peter novig's spell correction. uses probability theory

below code first check if english word or not. if not goes correction method belongs peter's algorithm

  def spell_correct(text):         try:             output = ""             splited_words = text.split()             d = enchant.dict("en_us")             in splited_words:                 if d.check(i):                     output = output + + " "                 else:                     output = output + correction(i) + " "         except exception e:             print(e)         return output 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -