40 #define PROGRAM_FEATURE_TYPE "cn" 69 BOOL8 WriteInsigProtos);
133 int main(
int argc,
char *argv[]) {
137 const char *PageName;
151 printf(
"Reading %s ...\n", PageName);
152 TrainingPage =
Efopen(PageName,
"rb");
154 100, NULL, TrainingPage, &CharList);
155 fclose(TrainingPage);
158 printf(
"Clustering ...\n");
162 pCharList = CharList;
171 if (Clusterer == NULL) {
172 fprintf(stderr,
"Error: NULL clusterer!\n");
186 printf(
"0 significant protos for %s." 187 " Retrying clustering with MinSamples = %f%%\n",
201 for (
int i = 0; i < freeable_protos.
size(); ++i) {
232 if (Directory != NULL && Directory[0] !=
'\0')
234 Filename += Directory;
237 Filename +=
"normproto";
238 printf (
"\nWriting %s ...", Filename.
string());
240 fprintf(File,
"%0d\n", feature_desc->
NumParams);
247 printf (
"\nError! Not enough protos for %s: %d protos" 248 " (%d significant protos" 249 ", %d insignificant protos)\n",
250 LabeledProto->
Label, N,
255 fprintf(File,
"\n%s %d\n", LabeledProto->
Label, N);
267 BOOL8 WriteSigProtos,
268 BOOL8 WriteInsigProtos)
void FreeNormProtoList(LIST CharList)
int ShortNameToFeatureType(const FEATURE_DEFS_STRUCT &FeatureDefs, const char *ShortName)
const FEATURE_DESC_STRUCT * FeatureDesc[NUM_FEATURE_TYPES]
void ParseArguments(int *argc, char ***argv)
const char * string() const
void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs)
const PARAM_DESC * ParamDesc
void FreeClusterer(CLUSTERER *Clusterer)
void AddToNormProtosList(LIST *NormProtoList, LIST ProtoList, char *CharName)
CLUSTERER * SetUpForClustering(const FEATURE_DEFS_STRUCT &FeatureDefs, LABELEDLIST char_sample, const char *program_feature_type)
FILE * Efopen(const char *Name, const char *Mode)
const char * GetNextFilename(int argc, const char *const *argv)
LIST ClusterSamples(CLUSTERER *Clusterer, CLUSTERCONFIG *Config)
void FreeTrainingSamples(LIST CharList)
int main(int argc, char **argv)
DECLARE_STRING_PARAM_FLAG(D)
#define PROGRAM_FEATURE_TYPE
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT &feature_defs, const char *feature_name, int max_samples, UNICHARSET *unicharset, FILE *file, LIST *training_samples)
struct LABELEDLISTNODE * LABELEDLIST
int NumberOfProtos(LIST ProtoList, BOOL8 CountSigProtos, BOOL8 CountInsigProtos)
void WriteNormProtos(const char *Directory, LIST LabeledProtoList, const FEATURE_DESC_STRUCT *feature_desc)
void WriteParamDesc(FILE *File, uinT16 N, const PARAM_DESC ParamDesc[])
void FreeProtoList(LIST *ProtoList)
void WritePrototype(FILE *File, uinT16 N, PROTOTYPE *Proto)
void WriteProtos(FILE *File, uinT16 N, LIST ProtoList, BOOL8 WriteSigProtos, BOOL8 WriteInsigProtos)