WORMHOLE\SX 1.0D Variation on a theme by B. Hanstede for use with 1st Word Plus, Word-Up, and WordPerfect, but with self-calibration to let it work with (some) other word-processors as well If you own 1st Word Plus or Word Up or WordPerfect, you are in for a strange adventure. If not, see the final paragraphs. Boot up with this accessory and run 1st Word Plus. Type a numerical expression, say 123.456 * 78.9 = Clicking on the accessory brings up a cursor that is shaped like cross-hairs. Take that to a point North-West of this expression. Make sure to clear the text with some room to spare. Press the right mouse button (with the STe you may press the left mouse- button instead, which you probably find more comfortable) and drag a box around the expression you just typed. Click again and you will see a little happening in the "move" bar of the word- processor and then, suddenly, as by magic, an answer appear at the cursor position: 123.456 * 78.9 = 9740.6784 This handwriting on the wall introduces you to a novel style of computing. WHSX_10.ACC can do all the arithmetical operations described for the Fleabyte simplex, version 1 (FBSX_10.ACC) e.g. 12 * |3 - 3^2| : 4 = 18 lg(0.1234) = -0.9086848403028 0.1234`10 = -0.9086848403028 sqr(123.456) = 11.1110755555 $1234.56 @ 7.5% = $92.59 5% of $234.56 = $11.73 And on top of that it can add columns of numerical data, 1234.567 2345.678 3456.789 -------- x or, indeed, add numbers splattered all over your wordprocessor's on-screen image. Put the curser where I typed the x and draw a box around the whole lot: 1234.567 2345.678 3456.789 -------- 7037.034 This result may well suggest to you that the Wormhole's under- lying technique could be shaped into an excellent tool for doing statistics. And indeed, so it can. To demonstrate this I turned this WHSX_10 accessory into a demo, WHSX_10D, for doing some common statistical calculations on a set of single data. In- cluded with the set is the word "stats." If you enclose that word with the data (but, please, don't put the word at the end) and if you don't cut corners, you will see a set of statistical observations appear. However if you place an edge of the box too close to "stats" you will merely obtain the sum of these numbers. Observe the clean lay-out of the data (ref. 1). The wordproces- sor seems to be an ideal vehicle for doing this sort of thing, especially because of its tabbing facility. stats 109 111 82 105 134 113 90 79 100 117 80 90 121 75 93 99 90 92 96 82 101 104 80 81 83 104 93 109 72 110 111 91 109 111 81 122 83 92 101 77 99 103 93 91 67 102 84 96 89 81 102 84 96 89 81 107 95 91 107 102 109 93 82 103 116 86 78 73 104 104 103 108 76 94 108 72 87 121 80 127 105 103 106 119 90 93 89 110 103 100 99 79 117 114 117 93 82 98 89 119 Mean: 96.81 Mean deviation: 11.646 Variance: 193.074 Standard deviation: 13.895 Corrected std dev.: 13.965 Skew: 0.157 Kurtosis: -0.561 Not all of the statistical description of the above data appears on-screen on the first try. At first one only gets: Mean: 96.81 Mean deviation: 11.646 Variance: Because the maximum number of characters the wormhole can safely transfer in one shot is 63, it was necessary to click a second and a third time on the name of the desktop accessory to complete the print-out. Of course, I could have chosen to incorporate statistics for paired sets of data or any other eventuality. As said, this is just a demonstration tagged on to WHSX_10.ACC. When the program reads the data, it puts plus-signs between them. These signs don't interfere in those instances one wishes to calculate the answer to some expression, e.g. 12.3*45/(67-89) becomes +12.3*+45/(+67+-89) This may look a little awkward, but the outcome is not changed. With columns of numbers to be added, the plus signs turn the whole affair in one giant addition. If the program encounters the word "stats" it sends the data off to a procedure named "statistics" where all thus plus signs are regarded as separators, like commas. To use the program correctly and with confidence it is well to understand a little about the techniques employed. After drawing a box around a mathematical expression or a set of numbers, the program scans the characters inside that box. Each character is held in an array of 16 by 8 pixels (for monochrome, that is - for medium color the arrays are 8 by 8). Internally each character requires eight bytes for a full description. If we do not clear these arrays sufficiently, there will be faulty readings "from the screen" and erroneous responses are the consequence. Hence the choice of crosshairs; they make precise, but rapid work much easier than any other cursor in the ST's arsenal. The characters are then individually identified by comparing them with elements of a library of characters held by the program. The characters in the library are the standard ST font. Therefore, you can only use the standard font with your wordprocessor. This program does have a bit of a history. I found the under- lying principle just described in the Dutch computer magazine "Start" (ref. 2). It was playfully referred to as "Optical Character Recognition." Its author, B. Hanstede, an official with the Department of Revenue, was looking for an efficient way of adding numbers. Using pieces of esoteric programming information that came his way this ST hobbyist managed to construct his program, "1st OCR." I can't help but have admiration for this person. It is one thing for a trained programmer to come up with something interesting, but it is quite another for a person not particularly versed in programming to doggedly pursue a healthy hunch and pull off something like "1st OCR." That is real genius at work! What I am presenting here is a spruced up "OCR" with a modified objective made possible as I began to better, if not fully under- stand what is going on in Hanstede's intriguing program. Al- though its extreme dependence on the wordprocessor chosen is a drawback, I regard the tool's efficiency as a marvellous applic- ation of electronic computing. (Purists and standard setters in the area of communications via buffers may consider this use of the operating system's input/output buffer not quite kosher, but what the heck! It is fascinating and efficient, isn't it? The present version not only corrects errors I knew about in an earlier published version of the Wormhole, it is also a big improvement operationally. For one thing, it does no longer require a separate calibrator. If the location of text is not found the accessory will automatically engage the procedure named "calibration." Thus it becomes possible to use the Worm- hole with, e.g. WordWriter (which employs only 15 pixels per line in monochrome), or to change wordprocessors, or to move the position of the document window in one's word-processor. This version zeros in without calibration on the normal text positions of 1st Word Plus (ref. to the procedure "init" in the program listing). Any other position will delay the first calculation a few seconds. You may observe that calibration occurs by the tardinesss of the happenings in the little penfield located near the top-left. Once calibration is done, subsequent calculations will run immediately except in WordWriter (at least in the version of it I have on hand). As said, that version allows only 15 pixels per line instead of the standard 16 for monochrome. Hence a calibration will occur for every line. This narrower line also prevents column addition on monochrome. This can be remedied, of course. All it takes is a little more time to program for it. (I shall be glad to try to cater to special needs if I find sufficient response to make the effort worth- while.) This program has been made on my Atari STe. It did not function properly on my STf (jumping at the cursor) when I used the left button of the mouse for drawing the lasso. Thus the program has been modified to allow for either left or right button of the mouse. (The right button always works, but I prefer the "feel" of the left button.) Remember that reference, "Optical Character Recognition" and don't even think of playing with characters other than those in TOS's own font. Henry K. van Eyken, 11, ch Falcon, Lakefield, Que. J0V 1K0. Canada REFERENCES 1. "Intelligence quotients made by 100 pupils on a mental test," originally from R.W.B. Jackson and George A. Ferguson, Manual of Educational Statistics. University of Toronto, Department of Educational Research, Toronto, 1942. 2. B. Hanstede, "1st OCR." (Dutch) Start, No.29, p.22 (May/June 1990). WORMHOLE\SX 1.1D Corrected an error and revised some lines in the procedure named "stats_demo."