You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Convert document from third person to second person

Is there any automated (or semi-automated) way to convert a document written in third person to second person?


I know I can use find/replace to change the pronouns, and then go through the spelling/grammar check to fix the verbs, but with dozens of documents to convert, this promises to take a long time and be quite a pain.


I'm hoping there's a script or application that can manage this, at least to get the documents 80-90% there with the click of a single button.

iMac with Retina 5K display, macOS Sierra (10.12.1)

Posted on Oct 26, 2016 8:13 AM

Reply
6 replies

Oct 26, 2016 6:18 PM in response to VikingOSX

A reply to the post on the Microsoft forums gave some code for a Word macro that works well.


I wonder if the same approach could be done in AppleScript?


Here's the VB code for the Word macro

Sub ChgVoice()
   Dim doc As Word.Document, rng As Word.Range
   Set doc = ActiveDocument
   Set rng = doc.Content
   If findNReplace(rng, "he", "you") = False Then MsgBox "he to you", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "him", "you") = False Then MsgBox "him to you", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "himself", "yourself") = False Then MsgBox "himself to yourself", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "his", "your") = False Then MsgBox "his to your", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "He", "You") = False Then MsgBox "He to You", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "His", "Your") = False Then MsgBox "His to Your", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "you seems", "you seem") = False Then MsgBox "you seems to you seem", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "You seems", "You seem") = False Then MsgBox "You seems to You seem", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "you tends", "you tend") = False Then MsgBox "you tends to you tend", vbExclamation, "Conversion Failed"
   If findNReplace(rng, "You tends", "You tend") = False Then MsgBox "You tends to You tend", vbExclamation, "Conversion Failed"
End Sub

Private Function findNReplace(ByRef rng As Word.Range, ByRef fWord As String, rWord As String) As Boolean
    On Error GoTo errHandler
    Dim iRng As Word.Range
    Set iRng = rng
    With iRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Forward = True
        .Format = False
        .MatchCase = True
        .MatchWholeWord = True
        .Wrap = wdFindStop
        .Text = fWord
        .Replacement.Text = rWord
        .Execute Replace:=wdReplaceAll
    End With
    findNReplace = True
    Exit Function
errHandler:
    findNReplace = False
End Function

Oct 27, 2016 6:54 AM in response to VikingOSX

Hi VikingOSX,


We're using Word for the particular project that prompted the question, but I was planning to use Pages to do the conversion if I could find a solution for Pages before finding one for Word. In the longer term, I'd love to have solutions for both as there's a chance we'll be able to move most of the process over to Pages by the time the next similar project comes around.

Oct 27, 2016 1:19 PM in response to A. Scott McCulloch

Scott,


Here is the ordered priority that I would place on getting the job done converting your Word documents from third-person to second-person sentence structure:

  1. Windows. Use the Word basic script that you posted in Word for Windows for the most accurate conversion.
  2. Mac. Use the Word basic script in Word 2016 for Mac (if supported), and use the Word AppleScript dictionary support to create a file list driven loop of converted Word documents output to another folder.


I did not recommend Pages above, because it is not a Word clone, does not open (translates) Word documents in their native format, and does not fully support Word 2013 or Word 2016 document features. Any missing font, or indigestable, Word document content that causes Pages to throw any dialog — will break an AppleScript. I am speaking from experience here, and it is a real PITA.


Converting a highly, industry application portable, Word document into a single platform (Mac) document format that no other application on the planet can open — is impractical. I, as well as many others, have experienced creating a Pages document, only to have the same application version refuse to subsequently open that document. I would not recommend Pages v5/v6 for mission critical, professional document usage.

Convert document from third person to second person

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.