TrainContext
1.0 2.0
Provides the
recognizer a previous recognition result that may contain errors, plus the
correct interpretation of the raw data.
Note This function
is provided only for compatibility with version 1.0 of the Pen API and will not
be supported in future versions. Use TrainHREC1AOCU_ instead.
BOOL TrainContext( LPRCRESULT lprcresult,
LPSYE lpsye, int csye, LPSYC lpsyc,
int csyc )
Parameters
lprcresult
Address of
the RCRESULT
lpsye
Address of an
array of SYE iSyc members of these
structures index the SYC
structures pointed to be the lpsyc parameter.
csye
The number of
SYE structures in the lpsye array.
lpsyc
An array of SYC
structures that establish the mapping between the raw data and the characters
in the hpendata member of the structure pointed to by the lprcresult
parameter.
csyc
The number of
SYC structures in the lpsyc array.
Return Value
Returns TRUE
if the ink is accepted for training; otherwise, returns FALSE.
Comments
TrainContext is called by an application with a recognition result
that may contain mistakes, along with a correct interpretation, so that the
recognizer can learn from the mistake and improve subsequent recognition. A
second, simpler training function for 1.0 recognizers is provided by TrainInk
TrainContext internally calls the function TrainContextInternal
exported by the recognizer identified by the hrec member of the RC
When a
training application is able to provide contextual information (such as
segmentation suggestions) to the version 1.0 recognizer, it calls the TrainContext
function. The lprcresult parameter points to an RCRESULT
structure that contains the results of a previous recognition. The raw data is
also contained in the hpendata member of the structure pointed to be lprcresult.
In addition
to providing the incorrect interpretation of the data (by means of the symbol
graph, the lpsyv member in the RCRESULT structure), a more
detailed, correct interpretation is also provided by the SYE
Suppose, for
example, that a user writes lc, and the recognizer interprets it as k . A
trainer calls TrainContext using, first, an array of SYC
structures that point to the ink of the lc and, second, the two SYE
structures with the SYV values l and c . These two SYE
structures share the same index into the lpsyc array, indicating that
both use the ink that was interpreted as k .
Segmentation
errors can be corrected in the other direction as well. Suppose, for example,
the user writes k and the recognizer interprets it as lc . A trainer could
call TrainContext using a single SYE with SYV values equal
to k and an array of SYC structures that incorporate the ink the
recognizer had previously assigned to the l and the c .
To train
several SYV symbol values to a single piece of ink (for example, a long
stroke that is an he ligature), there will be two consecutive SYE structures one for the h and one for the e . Both SYE
structures have the same iSyc member; this means that the SYE structures
both point to the same ink. A recognizer must take this into consideration to
avoid training the two characters separately using the same ink for both; that
would result in having he trained as he he .
A recognizer
can supply its own custom training dialog boxes. An application should check
whether the recognizer supports custom training by calling ConfigRecognizer
The trainer
does not display an error message if TrainInk232HBEC or TrainContext returns FALSE.
Error messages that occur when training fails must be handled by the
recognizer.
See Also