The HotDocs Computation Archive
Get Extra Help

0138 - Paragraph Punctuator

Description:

Automatically determines end-of-paragraph punctuation for a series of conditional paragraphs.


• Code •

(parInitMC-c Computation)

// List settings
SET parMark-t TO ";"
SET parConj-t TO "and"

// Set the COUNT and COUNTER
SET parCTR-n TO 0
SET parCNT-n TO COUNT( MCVar )
 
 
(parInitTF-c Computation)

// Paragraph settings
SET parMark-t TO ","
SET parConj-t TO "or"

// Initialize the COUNT and COUNTER variables
SET parCNT-n TO 0
SET parCTR-n TO 0

// Set the COUNT
IF TF1
   SET parCNT-n TO parCNT-n + 1
END IF

IF TF2
   SET parCNT-n TO parCNT-n + 1
END IF

IF TF3
   SET parCNT-n TO parCNT-n + 1
END IF

IF TF4
   SET parCNT-n TO parCNT-n + 1
END IF

IF TF5
   SET parCNT-n TO parCNT-n + 1
END IF
 
 
(parPunc-c Computation)

// Increment the counter
SET parCTR-n TO parCTR-n + 1

// Initial paragraphs
IF parCTR-n < parCNT-n - 1
   "«parMark-t»"

// Penultimate paragraph
ELSE IF parCTR-n = parCNT-n - 1
   "«parMark-t» «parConj-t»"

// Last paragraph
ELSE
   "."
END IF

• Explanation •

In legal texts, it is common for a series of paragraphs to all belong to one extended sentence. A simple example is:

The board shall prepare a state plan for management of radioactive waste by July 1, 20xx. The plan shall:
  1. provide an estimate of radioactive waste capacity needed in the state for the next 20 years,
  2. assess the state's ability to minimize waste and recycle,
  3. evaluate radioactive waste treatment and disposal options, as well as radioactive waste needs and existing capacity,
  4. evaluate facility siting, design, and operation, and
  5. review funding alternatives for radioactive waste management.

A difficulty arises when each section becomes conditional, since any one of the sections could end up being at the first, middle, or end of the paragraph. So determining the punctuation mark for each item can become very complex. This computation will automatically determine and insert the proper punctuation for each item or paragraph.

The system uses two computations:

  1. An initializing computation, which must be re-written for each paragraph group, and
  2. The punctuation inserter, which is 100% reusable without modification.

Initializing Computation

These paragraph blocks are usually controlled by either a multiple choice variable or by a series of true/false variables. A model computation for each type has been provided: parInitMC-c for multiple-choice-based paragraph blocks, and parInitTF-c for true/false-based paragraph blocks. By simply changing the variable names, the models can be adapted to any scenario.

The initializing computation performs the following steps:

The initializing computation should be placed immediately before the block of paragraphs.

Punctuation Computation: parPunc-c

The heart of the system is parPunc-c. By simply placing this computation at the end of each paragraph in the block, the correct punctuation mark will always be inserted.

How it works: Each time this computation is called, it increments the counter parCTR-n and tests it against the count parCNT-n. If the current counter is less than the total count, it just inserts a punctuation mark. If the current counter is one away from the total count, it inserts a punctuation mark and a conjunction (and/or). If the current counter equals the total count, it inserts a period.

The punctuation mark inserted is controlled by parMark-t. The conjunction used is controlled by parConj-t.

 

• Model Template •

This template has everything you need set up and configured for you. It will work as-is, or can be adapted to your variable and dialog names. It contains: 1) sample Word and WordPerfect templates (or an Automator form) to demonstrate an implementation of the computation, 2) a component file containing the computation and all supporting dialogs and variables, and 3) instructions for adapting the computation for your use.

(Go to the download page)

 
 

• Contributors •

LegalCS