Hi Friends,
I have just started working over one utility or better to say code which will give me list of suggestions words for a wrongly spell word.
Say for example:
For my word is "vurak"
Output : viral,quark,vera,aura,lurk
Similarly
My word is "Indai"
Output: India,Indian,Indi
Spell Suggestion Utility
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.Word;
{
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
string strReturn = "";
if (MyWord.Trim().Length > 0)
{
app.Documents.Add();
if (app.CheckSpelling(textBox3.Text))
strReturn += "Spelling is Correct \n";
else
{
foreach (object item in app.GetSpellingSuggestions(textBox3.Text))
strReturn += (item as SpellingSuggestion).Name+ "\n";
}
}
else
strReturn = "Word is empty";
app.Quit();
return strReturn;
}
Okay, thats it, you just need to copy and past above short method, I have done lot of search and found : Bing webService, AfterDeadline.dll, but for bulk data,which I have for Text Mining, the above mention approach suits my application, hence I have used it :)
Do share your comments, regarding the same, and doubts, if any.
Thanks for going through my post :)
I have just started working over one utility or better to say code which will give me list of suggestions words for a wrongly spell word.
For my word is "vurak"
Output : viral,quark,vera,aura,lurk
Similarly
My word is "Indai"
Output: India,Indian,Indi
And few days before I have posted, above post to which I found solution from web, but this was so much time consuming to find and refine the codes, as everywhere spell checking utility is given over web, but our verge was different to go to spell suggestions. Below mention is the tiny code written in C#, using Visual Studio 2010
Spell Suggestion Utility
//Special References to add, I have not mention default references
using Microsoft.Office;using Microsoft.Office.Interop;
using Microsoft.Office.Interop.Word;
//Method which returns CSV(Comma Seperated Values) of suggestions of words, for MyWord passed as parameter
private string GetSpellingSuggestions(string MyWord){
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
string strReturn = "";
if (MyWord.Trim().Length > 0)
{
app.Documents.Add();
if (app.CheckSpelling(textBox3.Text))
strReturn += "Spelling is Correct \n";
else
{
foreach (object item in app.GetSpellingSuggestions(textBox3.Text))
strReturn += (item as SpellingSuggestion).Name+ "\n";
}
}
else
strReturn = "Word is empty";
app.Quit();
return strReturn;
}
// Note: MS Office is required
Do share your comments, regarding the same, and doubts, if any.
Thanks for going through my post :)
No comments:
Post a Comment