Squeak Class Documentation category index | class index  
 
CharRecog
  category: System-Support
  superclass: Object
  subclasses:

Alan Kay's "one-page" character recognizer. Currently hooked up to text panes and to text morphs, such that you can get it started by hitting cmd-r in such text area that currently has focus.

To reinitialize the recognition dictionary, evaluate

CharRecog reinitializeCharacterDictionary

instance methods
  historical & disused
  directionFrom:to:
learnPrev
recogPar
recognize
recognizeAndPutInTranscript

  morphic dockup
  textMorph:

  recognizer
  extractFeatures
fourDirsFrom:to:
recognizeAndDispatch:ifUnrecognized:until:
recognizeAndDispatch:until:
regionOf:
stringForUnrecognizedFeatures:

class methods
  initialization
  initialize
reinitializeCharacterDictionary

  saving dictionary
  readRecognizerDictionaryFrom:
saveRecognizerDictionaryTo:

instance methods
  historical & disused top  
 

directionFrom:to:

This does 8 directions and is not used in current recognizer


 

learnPrev

The character recognized before this one was wrong. (Got here via the gesture for 'wrong'.) Bring up a dialog box on that char. 8/21/96 tk


 

recogPar

Inits


 

recognize

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:


 

recognizeAndPutInTranscript

Call Alan's recognizer repeatedly until the mouse is near the left edge of the screen, and dispatch keystrokes inferred to the Trancript. 2/2/96 sw


  morphic dockup top  
 

textMorph:


  recognizer top  
 

extractFeatures

get extent bounding box


 

fourDirsFrom:to:

get the bounding box


 

recognizeAndDispatch:ifUnrecognized:until:

Recognize characters, and dispatch each one found by evaluating charDispatchBlock; proceed until terminationBlock is true. This method derives directly from Alan's 1/96 #recognize method, but factors out the character dispatch and the termination condition from the main body of the method. 2/2/96 sw. 2/5/96 sw: switch to using a class variable for the character dictionary, and don't put vacuous entries in the dictionary if the user gives an empty response to the prompt, and don't send empty characters onward, and use a variant of the FillInTheBlank that keeps the prompt clear of the working window. 8/17/96 tk: Turn cr, tab, bs into strings so they work.
9/18/96 sw: in this variant, the block for handling unrecognized features is handed in as an argument, so that in some circumstances we can avoid putting up a prompt. unrecognizedFeaturesBlock should be a one-argument block, which is handed in the features and which is expected to return a string which indicates the determined translation -- empty if none.


 

recognizeAndDispatch:until:

Recognize characters, and dispatch each one found by evaluating charDispatchBlock; proceed until terminationBlock is true. 9/18/96 sw


 

regionOf:

it's some other character


 

stringForUnrecognizedFeatures:

Prompt the user for what string the current features represent, and return the result. 9/18/96 sw


class methods
  initialization top  
 

initialize

Iniitialize the character dictionary if it doesn't exist yet. 2/5/96 sw


 

reinitializeCharacterDictionary

Reset the character dictionary to be empty, ready for a fresh start. 2/5/96 sw


  saving dictionary top  
 

readRecognizerDictionaryFrom:

Read a fresh version of the Recognizer dictionary in from a file of the given name. 7/26/96 sw


 

saveRecognizerDictionaryTo:

Save the current state of the Recognizer dictionary to disk. 7/26/96 sw