I asked for help earlier, but folks said it was too difficult and too big, and certainly would take a lot longer than the 4 minutes I specified it would take me on a mainframe computer. I'm talking about a VB script that would conquer the word repetition problem in a text. (For instance, you shouldn't use words such as "evaluate" or "notice" or "opalescent" or whatever twice in two or three or even four consecutive sentences.
Now I'm going to write a little pseudo-script here; all I ask is for you guys to replace English with VB, line for line. I'd really appreciate any help here!
Here goes. First, we take the text file (a manuscript of some length; maximum 200,000 words), put it in word, and get rid of all punctuation, replacing it with spaces (all periods, commas, semi-colons, colons, quotes, dashes, question marks, exclamation marks - did I miss anything?) Then we replace all NUMERIC values with spaces. Then we look for all instances of multiple spaces and replace them with single spaces. Now we have a text file that only contains words and single spaces.
Now the first part of the script will replace all single spaces with numbers, each subsequent number greater than the number that precedes it, by 1, and produce a new file.
So, definition statements - Sub, or whatever, var integer? ...
Sub var integer Counter1 (make it zero).
Now we do a loop like this:
Do (until end of input file or counter1 greater than 200,000
Counter1 = Counter1 + 1
read one byte from the input file
If the value of the byte = "space"
write counter1 to the output file
else
write the byte you've got from the input file to the output file
end-if
loop
This will produce a file with words and numbers, with the numbers in ascending order.
Now the second part of the script will read this new file and display the instances (numbered) of word repetition (the same word used more than once in a string 40 words long or less)
Sub var integer Counter1 (set to 0)
Sub var integer Counter2 (set to 0)
Sub var Alphabetic String1
Sub var Alphabetic String2
Do (until we reach the end of file)
Add +1 to Counter1
put the value of Counter1 into Counter2
find the number in the file that matches the value in Counter1
get the alphabetic string that follows it, and put it into Alphabetic String1
Do (until Alphabetic String1 = Alphabetic String 2 OR Counter2 = Counter1 greater than 40
(i.e. more than forty words have been
scanned, no repetition has been found)
Add +1 to Counter2
find the number in the file that matches the number in Counter2
get the alphabetic string that follows it and put it into Alphabetic String2
If Alphabetic String1 = Alphabetic String2 (word repetition)
display the word and the two numbers
end-if
Loop
Loop
This should do it. Can anyone PLEASE help me convert the above into VB?
Now I'm going to write a little pseudo-script here; all I ask is for you guys to replace English with VB, line for line. I'd really appreciate any help here!
Here goes. First, we take the text file (a manuscript of some length; maximum 200,000 words), put it in word, and get rid of all punctuation, replacing it with spaces (all periods, commas, semi-colons, colons, quotes, dashes, question marks, exclamation marks - did I miss anything?) Then we replace all NUMERIC values with spaces. Then we look for all instances of multiple spaces and replace them with single spaces. Now we have a text file that only contains words and single spaces.
Now the first part of the script will replace all single spaces with numbers, each subsequent number greater than the number that precedes it, by 1, and produce a new file.
So, definition statements - Sub, or whatever, var integer? ...
Sub var integer Counter1 (make it zero).
Now we do a loop like this:
Do (until end of input file or counter1 greater than 200,000
Counter1 = Counter1 + 1
read one byte from the input file
If the value of the byte = "space"
write counter1 to the output file
else
write the byte you've got from the input file to the output file
end-if
loop
This will produce a file with words and numbers, with the numbers in ascending order.
Now the second part of the script will read this new file and display the instances (numbered) of word repetition (the same word used more than once in a string 40 words long or less)
Sub var integer Counter1 (set to 0)
Sub var integer Counter2 (set to 0)
Sub var Alphabetic String1
Sub var Alphabetic String2
Do (until we reach the end of file)
Add +1 to Counter1
put the value of Counter1 into Counter2
find the number in the file that matches the value in Counter1
get the alphabetic string that follows it, and put it into Alphabetic String1
Do (until Alphabetic String1 = Alphabetic String 2 OR Counter2 = Counter1 greater than 40
(i.e. more than forty words have been
scanned, no repetition has been found)
Add +1 to Counter2
find the number in the file that matches the number in Counter2
get the alphabetic string that follows it and put it into Alphabetic String2
If Alphabetic String1 = Alphabetic String2 (word repetition)
display the word and the two numbers
end-if
Loop
Loop
This should do it. Can anyone PLEASE help me convert the above into VB?