Object <- PatternMatchingEngine <- HandwritingRecognizer |
|
|
Init PMEAccept PMEGetReady PMEInput PMEMatch PMERematch PMESleep RegisterFeedBackFunction YieldToFeedBackFunction |
|
AcceptHiraganaOnlyRecognition CharacterKind HandwritingBoxSize HandwritingInputData HandwritingRecognizedData HandwritingTargetRange |
| Field | Type | |
|---|---|---|
| PatternMatchingEngine: | engineState: | UnsignedShort |
| inputTiming: | UnsignedShort | |
| matchingQuality: | UnsignedShort | |
| HandwritingRecognizer: | characterKind: | Unsigned |
| handwritingBoxSize: | Dot | |
| handwritingTargetRangeStart: | UnsignedShort | |
| handwritingTargetRangeLength: | UnsignedShort | |
| handwritingInputData: | ObjectList | |
| handwritingRecognizedData: | SegmentArray |
Define Class HandwritingRecognizer; abstract; inherits from PatternMatchingEngine; field characterKind: Unsigned, getter, setter; // Client sets to specify what character it is looking for. // Engine gets and tries its best to do the recognition as specified. // Client dynamicaly sets. // This is just a hint. Client should not assume that engine // returns only the characters they want. field handwritingBoxSize: Dot; // Client sets and dynamically changes the box size. // Engine uses it to determine relative position of the data. field handwritingTargetRangeStart: UnsignedShort; field handwritingTargetRangeLength: UnsignedShort; // set in PMEMatch. This range of inputData is used for matching. field handwritingInputData: ObjectList, getter; // List element is a IntegerList. // Each IntegerList contains StrokeDataHeader and position of stroke points. // The order of the list is the order of input. field handwritingRecognizedData: SegmentArray, getter; // Client can read the contents of the output data using the standard // Array API. attribute AcceptHiraganaOnlyRecognition: Boolean, readOnly, noGetter; // Return true if engine implements fast recognition for hiragana and // want information about kind of target character. // If this is true, HandwritingBoard in Japan package display a switch to // select hiragana or all character and set CharacterKind of recognizer // kPMEKindHiraganaCharacterMask or kHWRKindAnyCharacterMask before // calling PMEGetReady. attribute CharacterKind: Unsigned; attribute HandwritingBoxSize: Dot; attribute HandwritingTargetRange: InputPieceRange, readOnly; attribute HandwritingInputData: ObjectList, readOnly; attribute HandwritingRecognizedData: SegmentArray, readOnly; overrides Init; overrides PMEGetReady; // Default operation resets targetRange, inputData, and outputData. overrides PMEInput; // Default operation validates and appends thisPiece to inputData. // thisPiece may be a IntegerList for a stroke or a ObjectList which // contains several IntegerLists for each stroke. overrides PMEMatch; // Default operation validates and sets segHint.inputPieceRange // to targetRange. overrides PMERematch; // Default operation validates resgeHint and sets hwrTargetRange. overrides PMEAccept; // Default operation validates and sets clientChoice to outputData's // client choice. overrides PMESleep; // Default operation destroys inputData and outputData. intrinsic RegisterFeedBackFunction(newFunction: FeedBackFunction); intrinsic YieldToFeedBackFunction(loopCount: Unsigned); //***** InputPieceRange ***** // // It's a structure which represents a piece of inputData used in // SegmentationHint and SegmentInfo structure. // // InputPieceRange specifies a range from start-th element to // (start+length-1)-th element inclusive. The very first element // is represented as [start : 0, length : 1]. // // For HWR defined as HandwritingRecognizer class, the inputData is ObjectList // and element is an isolated Scrrible. // By definition, Scribble may contain zero or more stroke-data. // Note that HandwritingRecognizer API treats Scribble object as one element, // not each stroke in the Scribble. // //**** Segmentation Hint ***** // // As an input argument for PMEMatch, client specifies segmentation information. // // 1) for HWR, [kPMESegAllAsOne, [0, n]] is specified to request the engine // to recognize all the first n Scribblesin the hwrInputData as a single // character. // // 2) for HWR, [kPMESegUnspecified, [0, n]] to request the engine // do a segmentation and handwriting recogntion. // //**** Resegmentation Hint ***** // // After PMEMatch generates an outputData, client may request // to make a segment longer or shorter by one character and redo the pattern // matching. Engine updates the entire outputData. // delta < 0 : make it shorter by one character. // delta > 0 : make it longer by one character. // // Resegmentation for handwriting recognition may be tricky and // the PME model doesn't support all the cases. One limitation // comes from the fact that the PME model assumes the input data is a // time-sequence of input data element which is in the order of // the end-user data input operation. // With the resegmentationHint defined above, the client is not allowed // to reorder the sequence. // end class;