alexpgp: (Barcode)
[personal profile] alexpgp
Yesterday, I mentioned running into some VBA code that purported to do a count of the number of words in revised text. Specifically, upon encountering the addition
, Law 386-FZ of December 23, 2010
the function returns a value of 10.

As far as I can tell, the reason for this is that each comma, whether it stands alone (as in the case of the first comma) or is "stuck" to some text (as in the case of the comma after the number 23), is counted as a word, as is the hyphen in "386-FZ".

I have also determined that, for some squirrely reason, the word count for a revision that starts with a space character considers said space to be a word. (In other words, if the Word insertion point is sitting at the end of a word and you type a space followed by one word, the count is 2; if the insertion point is sitting after the space at the end of said word and you type the inserted word and a space, the count is 1).

Hypothesis 1: There exist other characters that increment the word count.

Hypothesis 2: This function may exhibit other bad habits.

Meanwhile, I managed to figure out a way to do an accurate word count of added revised words. The basic scheme is this:
do a word count, save the result as "start"
for each revision in the document
  if the revision is an insert
    delete it
next revision
do a word count, subtract the result from "start"
The number remaining at the end is the count of added revised words.

Cheers...
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

alexpgp: (Default)
alexpgp

January 2018

S M T W T F S
  1 2 3456
7 8910111213
14 15 16 17181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 6th, 2026 09:08 pm
Powered by Dreamwidth Studios