[squeak-dev] character recognition

Bob Arning arning315 at comcast.net
Fri Mar 22 00:36:04 UTC 2013


Maybe 5 years before Genie. Here's the ancestor:

recognize | prv cdir result features char r s t dir |

"Alan Kay's recognizer as of 1/31/96.  This version preserved for 
historical purposes, and also because it's still called by the 
not-yet-deployed method recogPar.  Within the current image, the 
recognizer is now called via #recognizeAndDispatch:until:"


"Inits"                (p _ Pen new) defaultNib: 1; down.
     "for points"        pts _ ReadWriteStream on: #().

"Event Loop"
                     [(Sensor mousePoint x) < 50] whileFalse:

"First-Time"            [pts reset.
"will hold features"        ftrs _ ''.

                       (Sensor anyButtonPressed) ifTrue:
                         [pts nextPut: (bmin _ bmax _ t _ s _ sts _ 
Sensor mousePoint).
                         p place: sts. cdir _ nil.

"Each-Time"        [Sensor anyButtonPressed] whileTrue:
                         [
"ink raw input"            p goto: (r _ Sensor mousePoint).
"smooth it"                s _ (0.5*s) + (0.5*r).
"thin the stream"        ((s x - t x) abs > 3 or:[(s y - t y) abs > 3]) 
ifTrue:
                             [ pts nextPut: t.
"bounding box"            bmin _ bmin min: s. bmax _ bmax max: s.
"get current dir"                dir _ (self fourDirsFrom: t to: s). t _ s.
                             dir ~= ' dot... ' ifTrue: [
"store new dirs"                    cdir ~= dir ifTrue: [ftrs _ ftrs, 
(cdir _ dir)]].
"for inked t's"             p place: t; go: 1; place: r.
                             ].
  "End Each-Time Loop"    ].

"Last-Time"

"save last points"        pts nextPut: t; nextPut: r.
"find rest of features"    features _ self extractFeatures.
"find char..."            char _ CharacterDictionary at: features ifAbsent:
"...or get from user"            [ result _ FillInTheBlank request:
                              'Not recognized. type char, or type ~: ', 
features.
"ignore or..."                result = '~' ifTrue: ['']
"...enter new char"            ifFalse: [CharacterDictionary at: 
features put: result. result]].

"control the editor"        (char = 'cr' ifTrue: [Transcript cr] ifFalse:
                         [char = 'bs' ifTrue: [Transcript bs] ifFalse:
                         [char = 'tab' ifTrue:[Transcript tab] ifFalse:
                         [Transcript show: char]]]).

"End First-Time Loop"    ].

"End Event-Loop" ].



On 3/21/13 8:06 PM, Colin Putney wrote:
>
>
>
> On Thu, Mar 21, 2013 at 4:07 PM, Bert Freudenberg 
> <bert at freudenbergs.de <mailto:bert at freudenbergs.de>> wrote:
>
>     The recognizer still works in the Etoys image.
>
>
> Was that Genie, or another system?
>
> It seems like Genie is still available, though it probably doesn't 
> work in modern Squeak:
>
> http://bike-nomad.com/squeak/monticello/Genie/
>
> Colin
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130321/f6e8753e/attachment.htm


More information about the Squeak-dev mailing list