This is a migrated thread and some comments may be shown as answers.

Google spellcheck service

6 Answers 128 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 10 May 2010, 10:36 PM
Wasnt this implemented recently? I even had information on how to put it in -

Create a GoogleSpellCheckProvider class that implements the ISpellCheckProvider.

Set SpellCheckProviderTypeName property of RadSpell to = typeof(Telerik.Web.UI.GoogleSpellCheckProvider).AssemblyQualifiedName of compiled GoogleSpellCheckProvider created.

This still works?

Thanks.

Roland

6 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 11 May 2010, 12:16 PM
Hello Roland,

You should set the AllowAddCustom  property to false too.
A simple example which illustrates how to use GoogleSpellCheckProvider is available here:
http://demos.telerik.com/aspnet-ajax/spell/examples/googlespell/defaultcs.aspx
Let us know if you have any other questions.


Regards,
Petio Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Roland
Top achievements
Rank 1
answered on 11 May 2010, 05:54 PM
Hi Petio.

Thanks for the reply. Yes, i set that property as well.

The next problem we had was our company has some issues with letting Google be the dictionary as well so we wanted to spellcheck locally but send mistaken words to the service instead as it gives better suggestions.

So I tweaked the GoogleSpellCheckProvider class as follows -

public GoogleSpellCheckProvider(SpellChecker checker)  
        {  
            this.checker = checker;  
            this.textWords = checker.TextWords;  
            this._language = checker.DictionaryLanguage.Substring(0, 2).ToLower();  
            StringBuilder sb = new StringBuilder();  
 
            //create new spellcheck to check words.   
            SpellChecker chk = new SpellChecker(HttpContext.Current.Server.MapPath("~/App_Data/RadSpell/"));  
            chk.SpellCheckProvider = SpellCheckProvider.PhoneticProvider;  
            chk.Text = checker.Text;  
            chk.WordIgnoreOptions = checker.WordIgnoreOptions;  
              
            SpellCheckErrors errors = chk.CheckText();  
 
            //append misspelled words instead of ALL the words.   
            foreach (SpellCheckError error in errors)  
            {  
                sb.Append(error.MistakenWord);  
                sb.Append(" ");  
            }  
              
            //for (int i = 0; i < textWords.Length; i++)  
            //{  
            //    sb.Append(textWords[i].Word);  
            //    sb.Append(" ");  
            //}  
            this._text = sb.ToString();  
            //make Google request  
            string uri = BuildUri(this._language);  
            byte[] buffer = Encoding.UTF8.GetBytes(get_request(this._text));  
            WebClient webClient = new WebClient();  
            webClient.Headers.Add("Content-Type""text/xml");  
            byte[] response = webClient.UploadData(uri, "POST", buffer);  
            string resultXML = Encoding.UTF8.GetString(response);  
            this.parseResultXML(resultXML); //fill the suggestions dictionary  
        } 

Seems to be working fine. Am I missing anything?

Thanks.

Roland
0
Petio Petkov
Telerik team
answered on 13 May 2010, 02:37 PM
Hi Roland,

Everything in the code provided seems to be fine.
My suggestion is to add try/catch for the code related to the Google SpellCheck service - if you cannot reach Google due to some reason(e.g. missing connectivity), use the already found mistaken words from the Telerik.Web.UI.SpellChecker.

All the best,
Petio Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Roland
Top achievements
Rank 1
answered on 09 Nov 2010, 01:04 AM
Hi Petio.

Did the ISpellCheckProvider get removed from the recent releases?

Thanks.

Roland
0
Rumen
Telerik team
answered on 09 Nov 2010, 04:06 PM
Hi Roland,

No, it is not. You can see the ISpellCheckProvider is used in the following demo:

Custom Google spellcheck provider.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roland
Top achievements
Rank 1
answered on 09 Nov 2010, 06:45 PM
Hi Rumen.

Thanks for the reply. Just seemed odd that some functionality went down when I upgraded to Q1 2010 for spellcheck and treeview. Upgrading to Q2 2010 fixed a lot of issues.

Thanks.

Roland
Tags
Spell
Asked by
Roland
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Roland
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or