Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio C# grammar/sentence structure-checking method [duplicate]

I'm working with C# in Visual Studio. I need an object to which I can send a String containing an English sentence. I need the object to have a method that will tell me if my English sentence has any grammar/structure errors.

Think of the spell/grammar checker in MS Word. Any grammar/structure errors will be underlined by a green line. I need to determine if any arbitrary sentence would have a green underline if it were written in MS Word.

If such a thing exists it may look like this:

checkGrammar("Arbitrary sentence");   //returns true/false based on being      correct or not.

I have looked for something like this but all my search efforts are dominated by results for a Visual Studio Spell Checker which checks your actual code....not what I need.

Does anyone know if such a thing exists in C#?

Thanks in advance for any help.

like image 534
Jordan Saunders Avatar asked Oct 21 '25 04:10

Jordan Saunders


1 Answers

You may be able to use Word's Grammar checker grammatically if you can be sure it will be installed on the computer running the program.

Documentation

Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();

return word.CheckGrammar("String to check");
like image 181
Bradley Uffner Avatar answered Oct 23 '25 19:10

Bradley Uffner