Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 422057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:02:37+00:00 2026-05-12T19:02:37+00:00

I want to process a medium to large number of text snippets using a

  • 0

I want to process a medium to large number of text snippets using a spelling/grammar checker to get a rough approximation and ranking of their “quality.” Speed is not really of concern either, so I think the easiest way is to write a script that passes off the snippets to Microsoft Word (2007) and runs its spelling and grammar checker on them.

Is there a way to do this from a script (specifically, Python)? What is a good resource for learning about controlling Word programmatically?

If not, I suppose I can try something from Open Source Grammar Checker (SO).

Update

In response to Chris’ answer, is there at least a way to a) open a file (containing the snippet(s)), b) run a VBA script from inside Word that calls the spelling and grammar checker, and c) return some indication of the “score” of the snippet(s)?

Update 2

I’ve added an answer which seems to work, but if anyone has other suggestions I’ll keep this question open for some time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:02:38+00:00Added an answer on May 12, 2026 at 7:02 pm

    It took some digging, but I think I found a useful solution. Following the advice at http://www.nabble.com/Edit-a-Word-document-programmatically-td19974320.html I’m using the win32com module (if the SourceForge link doesn’t work, according to this Stack Overflow answer you can use pip to get the module), which allows access to Word’s COM objects. The following code demonstrates this nicely:

    import win32com.client, os
    
    wdDoNotSaveChanges = 0
    path = os.path.abspath('snippet.txt')
    
    snippet = 'Jon Skeet lieks ponies.  I can haz reputashunz?  '
    snippet += 'This is a correct sentence.'
    file = open(path, 'w')
    file.write(snippet)
    file.close()
    
    app = win32com.client.gencache.EnsureDispatch('Word.Application')
    doc = app.Documents.Open(path)
    print "Grammar: %d" % (doc.GrammaticalErrors.Count,)
    print "Spelling: %d" % (doc.SpellingErrors.Count,)
    
    app.Quit(wdDoNotSaveChanges)
    

    which produces

    Grammar: 2
    Spelling: 3
    

    which match the results when invoking the check manually from Word.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of large files where I want to process all but
I want to process a String, in which I want to find multiple strings,
I want to have a real-time process take over my computer. :) I've been
If I have two sequences and I want to process them both together, I
I have a few log.debugs() that I don't want to process (since they are
I am in looking for a buffer code for process huge records in tuple
I first process a matrix in cublas, I have already sent it to device
I want to traverse through all the elements of an word document one by
Where do you draw the line when moving functions which operate on data into
I my current team we organize the dependencies to external libraries headers in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.