summaryrefslogtreecommitdiff
path: root/sys/src/libscribble/li_recognizer_internal.h
blob: ebad8048d5d68933594c7dbe8dd83dd4f96caee1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 *  li_recognizer_internal.h
 *
 *  Adapted from cmu_recognizer_internal.h.
 *  Credit to Dean Rubine, Jim Kempf, and Ari Rapkin.
 */

#define MAXSCLASSES 100

typedef struct PointList {
	Stroke;
	int xrange, yrange;
	struct PointList* next;
} point_list;

typedef struct {
    char*		file_name;			/*The classifier file name.*/
    int		nclasses;				/*Number of symbols in class */
    point_list*	ex[MAXSCLASSES];		/*The training examples.*/
    char*		cnames[MAXSCLASSES];	/*The class names.*/
    point_list*	canonex[MAXSCLASSES];	/*Canonicalized vrsions of strokes */
    point_list*	dompts[MAXSCLASSES];	/*Dominant points */
} rClassifier;


/*This structure contains extra fields for instance-specific data.*/

typedef struct {
    /*Instance-specific data.*/
    uint li_magic;            /*Just to make sure nobody's cheating.*/
    rClassifier li_rc;         /*The character classifier.*/
} li_recognizer;


/*Name of the default classifier file.*/
#define LI_DEFAULT_CLASSIFIER_FILE   "default.cl"

/*Classifier file extension.*/
#define LI_CLASSIFIER_EXTENSION ".cl"

/*Locale supported by recognizer.*/
#define LI_SUPPORTED_LOCALE  REC_DEFAULT_LOCALE