hello I want a code which can correct the spelling mistakes as well as grammatical mistakes in the sentences...that is if I am writing following sentence: I want too meet my frnd bt due to hectic shcedule I cant I want output in following way: I want to met my friend but due to hectic schedule I can't. Thanks in advance Shilpa Rai MSc IIT Bomaby -- View this message in context: http://r.789695.n4.nabble.com/spelling-correction-using-R-tp4633454.html Sent from the R help mailing list archive at Nabble.com.
Hello, On Fri, Jun 15, 2012 at 1:10 AM, raishilpa <raishilpa.bhu at gmail.com> wrote:> I want a code which can correct the spelling mistakes ?as well as > grammatical mistakes in the sentences...that is if I am writing following > sentence: > > I want too meet my frnd bt due to hectic shcedule I cant > > I want output in following way: > > I want to met my friend but due to hectic schedule I can't.In general, you would build a dictionary, look up for every word in the input whether it is in the dictionary, and if not, which is the most similar word using some string metric. You will, however, face problems: - No dictionary is ever complete - Some wrong words are equally similar to multiple correct words (e.g. should "bt" be "bit" or "but" or "bat"?) - Not all errors lead to wrong words (e.g. "Sum errors will will nut bee fond because they happen to leed two sentence consisting of reel word") It is therefore doubtful that spell-correction can be done non-interactively. Take care Oliver -- Oliver Ruebenacker Bioinformatics Consultant (http://www.knowomics.com/wiki/Oliver_Ruebenacker) Knowomics, The Bioinformatics Network (http://www.knowomics.com) SBPAX: Turning Bio Knowledge into Math Models (http://www.sbpax.org)
Grammar is quite complicated, but for spelling you might try this wonderful article by Peter Norvig: http://norvig.com/spell-correct.html Michael On Fri, Jun 15, 2012 at 12:10 AM, raishilpa <raishilpa.bhu at gmail.com> wrote:> hello > > I want a code which can correct the spelling mistakes ?as well as > grammatical mistakes in the sentences...that is if I am writing following > sentence: > > I want too meet my frnd bt due to hectic shcedule I cant > > I want output in following way: > > I want to met my friend but due to hectic schedule I can't. > > Thanks in advance > > Shilpa Rai > MSc > IIT Bomaby > > -- > View this message in context: http://r.789695.n4.nabble.com/spelling-correction-using-R-tp4633454.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
On Fri, Jun 15, 2012 at 8:24 AM, shilpa rai <raishilpa.bhu at gmail.com> wrote:> thanks to all :)Unless I suddenly became plural, I believe you meant to hit reply-all.> > I have found a code on nets , please visit the following link > > http://anrprogrammer.wordpress.com/2012/02/08/a-spell-checker-in-r/ > > when I am running this code I am getting following error > > ?Correct("speling", dtm = counts) > Error in out[i] <- paste(word[-i], collapse = "") :?object of type 'closure' > is not subsettableRunning the code on that link, I don't get that particular error, but one that's perhaps similar. The problem with the linked code is that it doesn't define out before using it. I might suggest you actually read the entire page -- the fix is already posted there. Michael> > I am unable to remove the error...can anyone help in removing the error...? > > > On Fri, Jun 15, 2012 at 6:40 PM, R. Michael Weylandt > <michael.weylandt at gmail.com> wrote: >> >> Grammar is quite complicated, but for spelling you might try this >> wonderful article by Peter Norvig: >> >> http://norvig.com/spell-correct.html >> >> Michael >> >> On Fri, Jun 15, 2012 at 12:10 AM, raishilpa <raishilpa.bhu at gmail.com> >> wrote: >> > hello >> > >> > I want a code which can correct the spelling mistakes ?as well as >> > grammatical mistakes in the sentences...that is if I am writing >> > following >> > sentence: >> > >> > I want too meet my frnd bt due to hectic shcedule I cant >> > >> > I want output in following way: >> > >> > I want to met my friend but due to hectic schedule I can't. >> > >> > Thanks in advance >> > >> > Shilpa Rai