Handwriting.mesa
Copyright Ó 1992, 1993 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, September 8, 1992 4:05 pm PDT
Christian Jacobi, May 6, 1993 8:53 pm PDT
Simple interface for dynamic handwriting recognition.
Dynamic means it is used in interactive context, character by character.
This interface is not yet really stable.
DIRECTORY
Rope USING [ROPE],
Xl USING [Point]; --Package depends only on types from Xl, not code.
Handwriting: CEDAR DEFINITIONS ~ BEGIN
Types
Stroke: TYPE = LIST OF Xl.Point; --Representing one stroke within one character
Strokes: TYPE = LIST OF Stroke; --Representing one character
TrainingDB: TYPE = REF; --A reference database of normalized character's
Normalized: TYPE = REF; --A set of normalized strokes (representing one character)
IsTrainingDB: PROC [x: REF] RETURNS [BOOL];
NarrowTrainingDB: PROC [x: REF] RETURNS [TrainingDB];
IsNormalized: PROC [x: REF] RETURNS [BOOL];
NarrowNormalized: PROC [x: REF] RETURNS [Normalized];
Temporary design consideration: TrainingDB and Normalized are not opaque so it is possible to change these types while developing the package. Clients must treat them as opaque.
Database operations, input output
May raise IO and PFS errors
ReadDB: PROC [name: Rope.ROPE] RETURNS [TrainingDB];
WriteDB: PROC [name: Rope.ROPE, db: TrainingDB];
MergeDB: PROC [into: TrainingDB ¬ NIL, db: TrainingDB] RETURNS [TrainingDB];
Copies db and merges it in into. May or may not be destructive or share data with into but not with db.
Training
A "Normalized" MUST NOT be trained more than once
Training and UnTraining may or may not be destructive to the database
UnTrainDB: PROC [db: TrainingDB, x: Normalized] RETURNS [TrainingDB];
TrainDB: PROC [db: TrainingDB, strokes: Strokes, ch: INT] RETURNS [TrainingDB];
TrainDBNormalized: PROC [db: TrainingDB, x: Normalized] RETURNS [TrainingDB];
NextNormalized: PROC [db: TrainingDB, x: Normalized] RETURNS [Normalized];
Normalization and access
Normalize: PROC [strokes: Strokes, ch: INT ¬ -1] RETURNS [Normalized];
UnNormalize: PROC [x: Normalized, sizemax: INT ¬ 40] RETURNS [strokes: Strokes];
Offset to [0, 0] from some center, sizemax maximum dimension in any direction from center
GetChar: PROC [x: Normalized] RETURNS [ch: INT];
SetChar: PROC [x: Normalized, ch: INT];
Char can be set or changed until x has been included into any training database
Recognition
Report: TYPE = RECORD [
ch: INT,
x: Normalized,
badness: INT --Smaller value means higher probability of correctness
];
Recognize: PROC [db: TrainingDB, strokes: Strokes] RETURNS [LIST OF Report];
RecognizeNormalized: PROC [db: TrainingDB, x: Normalized] RETURNS [LIST OF Report];
Returns guess for recognized character, in order of probability
END.