Skip to main content

Scripting Better Writing

Most writers develop patterns in their prose. Experts can use these patterns to calculate the likelihood that a given text was written by a particular author. For example, my weaknesses include "unfortunately" and "just." President Obama overuses the phrase, "Let me be clear." Does the president need our permission to be clear? I doubt anyone tries to obstruct presidential clarity.

Since buying my first copy of WordPerfect for DOS, I've maintained macros to help locate and remove my personal textual demons. The idea is simple: automatically highlight the words and phrases I might want to revise before submitting the text to an editor. Four years ago, a student noticed the red words in an open Word document on my laptop. She asked if the highlighting was part of Word's grammar or spellcheck features. I explained to her that when I finish writing a document I run several macros to mark potential problems.

When the student asked for a copy of the macro, I was confronted with what I call the "spellcheck" question: Does automatic "editing" help students?

There is a pedagogical concern when automating tasks associated with editing and revising. Teachers ask me if the automation leads to "laziness" among writers. I do not believe so. Using automation to highlight my weaknesses has helped me avoid the words and phrases during the writing process. In many ways, the word processor is acting as a coach. The macro I use does not change my words, nor does it suggest changes. Instead, I must decide if the highlighted words should be changed or removed. Sometimes, I leave the original words.

My students have found that customizing the macro for their individual writing patterns helps them discover patterns they didn't suspect existed. There are ways to generate "word frequency" tables, showing students which words they use most in a text. The frequency charts reveal "lots" of "really" abused words. Students are fascinated by this. The idea that a writer has a unique "voice" magically registers with students at that moment.

I am not opposed to automating editing tasks. No statistics instructor I know would oppose using Microsoft Excel macros. Creating the macros requires understanding the underlying concepts. A student has to understand what an adverb is and does before appreciating why some adverbs are "weak" word choices.

Below you will find the AppleScript I use when writing. When Microsoft shipped Office 2008 for the Mac, I had to convert my simple Visual Basic for Applications (VBA) macro to AppleScript. This conversion was also an opportunity to add functionality to the macro. I've been asked to cut word counts, reduce complexity, and target a broader audience. I added Word functions that help me meet the requirements of my editors.
Note: The AppleScript Editor has moved several times in OS X. In 10.6, the editor is located in the "Utilities" folder. You can use Spotlight to find the AppleScript Editor, if all else fails.
If you use MS Word for the Mac, the script I crafted can be copied and saved to the following folder:
~/Documents/Microsoft User Data/Word Script Menu Items/
-- Mark likely problems within a document
-- C. S. Wyatt 2010
--
-- List of Words to Mark as Potential Problems 
set markWords to {"about", "all", "almost", "a lot", "already", "always", "along with", "anxiously", ¬
"absolutely", "as well", "believe", "certainly", "clearly", ¬
"eagerly", "easy", "easily", "every", "feel", "felt", "few", "finally", "frequently", ¬
"good", "got", "intrigued", "intrigues", "just", ¬
"many", "merely", "must", "nearly", "need", "never", "nice", "not", "numerous", ¬
"only", "quick", "quickly", "so", "think", ¬
"utilize", "utilized", "utilizes", "very", ¬
"in the event", "in order to", "on the grounds that", "in case", "the public", ¬
"come to the conclusion"}
tell application "Microsoft Word"
-- Cycle through the markWords and Bold/Underline the words
repeat with theWord in markWords
set findRange to find object of text object of active document
tell findRange
set match whole word to true
set content of replacement of findRange to "{" & theWord & "}"
set bold of font object of replacement of findRange to true
set color index of font object of replacement of findRange to red
set underline of font object of replacement of findRange to underline thick
execute find find text theWord replace replace all
end tell
end repeat

-- Calculate stats
set statWordCount to compute statistics active document statistic statistic words
set statFKGradeLevel to get readability value of readability statistic 10 of text object of active document
set statParagraphs to get readability value of readability statistic 3 of text object of active document
set statSentences to get readability value of readability statistic 4 of text object of active document
set statSentPerParagraph to get readability value of readability statistic 5 of text object of active document
set statWordsPerSent to get readability value of readability statistic 6 of text object of active document
set statPassiveSents to get readability value of readability statistic 8 of text object of active document

-- Move to end of document
set currentDoc to text object of active document
insert break at currentDoc break type section break next page

-- Create a report on the document, after a page break
set currentDoc to collapse range currentDoc direction collapse end
insert paragraph at end of currentDoc
type text selection text "Report on Text"
type paragraph selection
type text selection text "Grade Level: " & statFKGradeLevel
type paragraph selection
type text selection text "Number of Paragraphs: " & statParagraphs & ¬
"; Sentences per Paragraph: " & statSentPerParagraph
type paragraph selection
type text selection text "Number of Sentences: " & statSentences & ¬
"; Words per Sentences: " & statWordsPerSent
type paragraph selection
type text selection text "Passive Sentences: " & statPassiveSents
type paragraph selection
type text selection text "Number of Words: " & statWordCount

end tell

Comments

Popular posts from this blog

Practical Technology Skills

This blog is a revision to a column I wrote for Direct Media publications. Normally, I wouldn't repost something I wrote for hire, and I certainly don't wish to anger one of my publishers. However, since this blog is primarily accessed by one of my graduate seminars, I think the publisher will appreciate that I am extending my thoughts for educational purposes. I'm also more than willing to encourage businesses to visit the Direct Media home page . Page numbers seemed to be a half-inch lower on each successive page. I stared at the mid-term paper, handed in to me by a junior at the university, and thought back to my fights with dot-matrix printers. When I was an undergrad, my Epson FX/80 printer jammed often and would sometimes rip pages after the sprockets slipped out of alignment with the punched holes of the perforated paper. Surely the undergraduate author of this paper suffered the curse of a similarly possessed printer, I told myself. “I guess when I changed the ma...

Pursuing a University Degree Online

Visalia Direct: Virtual Valley February 2008 Issue January 7, 2008 Pursuing a University Degree Online When a star high school student graduates in Tulare County, the difficult reality is that he or she most likely will leave to attend a four-year university. For an eighteen-year-old student, leaving the Central Valley, or at least Tulare County, is part of the educational experience. But, after returning to Visalia some of us find out that our undergraduate educations are not quite enough. For those in education, Fresno State, Fresno Pacific University, Chapman University, and others have offered courses in Visalia for a number of years. This makes it possible to work and still complete a teaching credential or an advanced education-related degree. I have been thankful for the options we have in the Central Valley. But, as others have learned, if you are interested in some fields you must commute to Fresno — or even further. With the drive to Fresno taking just under an hour...

MarsEdit and Blogging

MarsEdit (Photo credit: Wikipedia ) Mailing posts to blogs, a practice I adopted in 2005, allows a blogger like me to store copies of draft posts within email. If Blogger , WordPress, or the blogging platform of the moment crashes or for some other reason eats my posts, at least I have the original drafts of most entries. I find having such a nicely organized archive convenient — much easier than remembering to archive posts from Blogger or WordPress to my computer. With this post, I am testing MarsEdit from Red Sweater Software based on recent reviews, including an overview on 9to5Mac . Composing posts an email offers a fast way to prepare draft blogs, but the email does not always work well if you want to include basic formatting, images, and links to online resources. Submitting to Blogger via Apple Mail often produced complex HTML with unnecessary font and paragraph formatting styles. Problems with rich text led me to convert blog entries to plaintext in Apple Mail ...