xref: /plan9/sys/src/libscribble/li_recognizer_internal.h (revision 80ee5cbfe36716af62da8896207e9763b8e3d760)
1 /*
2  *  li_recognizer_internal.h
3  *
4  *  Adapted from cmu_recognizer_internal.h.
5  *  Credit to Dean Rubine, Jim Kempf, and Ari Rapkin.
6  */
7 
8 #define MAXSCLASSES 100
9 
10 typedef struct PointList {
11 	Stroke;
12 	int xrange, yrange;
13 	struct PointList* next;
14 } point_list;
15 
16 typedef struct {
17     char*		file_name;			/*The classifier file name.*/
18     int		nclasses;				/*Number of symbols in class */
19     point_list*	ex[MAXSCLASSES];		/*The training examples.*/
20     char*		cnames[MAXSCLASSES];	/*The class names.*/
21     point_list*	canonex[MAXSCLASSES];	/*Canonicalized vrsions of strokes */
22     point_list*	dompts[MAXSCLASSES];	/*Dominant points */
23 } rClassifier;
24 
25 
26 /*This structure contains extra fields for instance-specific data.*/
27 
28 typedef struct {
29     /*Instance-specific data.*/
30     uint li_magic;            /*Just to make sure nobody's cheating.*/
31     rClassifier li_rc;         /*The character classifier.*/
32 } li_recognizer;
33 
34 
35 /*Name of the default classifier file.*/
36 #define LI_DEFAULT_CLASSIFIER_FILE   "default.cl"
37 
38 /*Classifier file extension.*/
39 #define LI_CLASSIFIER_EXTENSION ".cl"
40 
41 /*Locale supported by recognizer.*/
42 #define LI_SUPPORTED_LOCALE  REC_DEFAULT_LOCALE
43