/* CSTLEMMA - trainable lemmatiser Copyright (C) 2002, 2005 Center for Sprogteknologi, University of Copenhagen This file is part of CSTLEMMA. CSTLEMMA is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. CSTLEMMA is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with CSTLEMMA; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "applyaffrules.h" /* #include "graph.h" #include "comp.h" */ #include "optionaff.h" //#include "caseconv.h" #include "argopt.h" #include #include #include #include #include #include // printf("usage: makeaffixrules -w -c -o -e -n -f [ [ [ [ [ []]]]]]\n"); bool VERBOSE = false; static char opts[] = "?@:B:c:e:f:hH:i:L:n:o:O:p:P:s:v:" /* GNU: */ "wr"; static char *** Ppoptions = NULL; static char ** Poptions = NULL; static int optionSets = 0; char * dupl(const char * s) { char * d = new char[strlen(s) + 1]; strcpy(d,s); return d; } optionStruct::optionStruct() { c = NULL; // cutoff e = NULL; // extra f = NULL; // compfunc i = NULL; // word list n = NULL; // columns o = NULL; // flexrules B = NULL; P = NULL; computeParms = false;// compute parms suffixOnly = false;// suffix rules only verbose = false;// verbose minperc = -1; // L maxperc = -1; // H simple = false;// if : use compute_parms, not comp_parms_off } optionStruct::~optionStruct() { for(int I = 0;I < optionSets;++I) { delete [] Poptions[I]; delete [] Ppoptions[I]; } delete [] Poptions; delete [] Ppoptions; delete [] c; delete [] e; delete [] f; delete [] i; delete [] n; delete [] o; delete [] B; delete [] P; } OptReturnTp optionStruct::doSwitch(int optchar,char * locoptarg,char * progname) { switch (optchar) { case '@': readOptsFromFile(locoptarg,progname); break; case 'B': // best parms B = dupl(locoptarg); break; case 'P': // current parms P = dupl(locoptarg); break; case 'c': // cutoff c = dupl(locoptarg); break; case 'e': // extra e = dupl(locoptarg); break; case 'f': // compfunc f = dupl(locoptarg); break; case 'L': minperc = strtol(locoptarg,(char**)0,10); if(minperc > 0 && maxperc == -1) maxperc = minperc; break; case 'H': maxperc = strtol(locoptarg,(char**)0,10); if(maxperc > 0 && minperc == -1) minperc = maxperc; break; case 'h': case '?': printf("usage:\n" "makeaffixrules [-@