⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 select-class-main.c

📁 Ripper 分类算法
💻 C
字号:
#include <stdio.h>#include "ripper.h"#include "protos.h"#include "mdb.h"/******************************************************************************/char *Program="select-class";char *Help_str[] = {    "syntax: select-class [options] -c class [stem]",    "   change class of examples of anything other than 'class' to 'default_class'",    "",    "options are:",    "  -s:       read from stdinput",    "  -v#:      set verbosity",    NULL};main(argc,argv)int argc;char *argv[];{    vec_t *data;    char *stem;    char *class_str;    symbol_t *class,*other;    int use_stdin;    example_t *exi;    int i,o;        /* defaults */    use_stdin = FALSE;    set_trace_level(NONE);    while ((o=getopt(argc,argv,"stv:c:h"))!=EOF) {	switch (o) {	  case 'c':	    class_str = optarg;	    break;	  case 's':	    use_stdin = TRUE;	    break;	  case 'v':	    set_trace_level(atoi(optarg)); 	    break;	  case 'h':	  case '?':	  default: 	    give_help();	    if (o=='h') exit(0);	    else fatal("option not implemented");	}    }    if (optind<argc) {	stem = argv[optind++];	ld_names(add_ext(stem,".names"));	if (use_stdin) data = ld_data(NULL);	else data = ld_data(add_ext(stem,".data"));    } else {	data = ld_data(NULL);    }    if (optind<argc) {	warning("not all arguments were used: %s ...",argv[optind]);    }    if (!data || vmax(data)==0) fatal("no examples");    /* change class of examples of anything other than 'class' to "other" */    class = intern(class_str);    other = intern("default_class");     for (i=0; i<vmax(data); i++) {	exi = vref(example_t,data,i);	if (exi->lab.nom != class) {	    exi->lab.nom = other;	}    }    fprint_data(stdout,data);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -